diff --git a/core/composer.json b/core/composer.json index 6d930cc..7935ddb 100644 --- a/core/composer.json +++ b/core/composer.json @@ -8,7 +8,7 @@ "symfony/routing": "2.1.*", "symfony/yaml": "2.1.*", "twig/twig": "1.8.*", - "doctrine/common": "2.2.*" + "doctrine/common": "2.3.*" }, "minimum-stability": "beta" } diff --git a/core/composer.lock b/core/composer.lock index e803ae3..83503ff 100644 --- a/core/composer.lock +++ b/core/composer.lock @@ -1,37 +1,37 @@ { - "hash": "2ea132b64c01235b70e9fb16c528ea0e", + "hash": "be2e79923e2be0777a9f60ec185168a8", "packages": [ { "package": "doctrine/common", - "version": "2.2.2" + "version": "2.3.0-BETA1" }, { "package": "symfony/class-loader", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-BETA4" }, { "package": "symfony/dependency-injection", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-BETA4" }, { "package": "symfony/event-dispatcher", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-BETA4" }, { "package": "symfony/http-foundation", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-BETA4" }, { "package": "symfony/http-kernel", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-BETA4" }, { "package": "symfony/routing", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-BETA4" }, { "package": "symfony/yaml", - "version": "v2.1.0-BETA1" + "version": "v2.1.0-BETA4" }, { "package": "twig/twig", diff --git a/core/includes/common.inc b/core/includes/common.inc index f2a4003..bcb6fb1 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4963,9 +4963,14 @@ function _drupal_bootstrap_full($skip = FALSE) { * Page compression requires the PHP zlib extension * (http://php.net/manual/ref.zlib.php). * + * @param $body + * The response body. + * @return + * The cached object or NULL if the page cache was not set. + * * @see drupal_page_header() */ -function drupal_page_set_cache() { +function drupal_page_set_cache($body) { global $base_root; if (drupal_page_is_cacheable()) { @@ -4973,7 +4978,7 @@ function drupal_page_set_cache() { 'cid' => $base_root . request_uri(), 'data' => array( 'path' => current_path(), - 'body' => ob_get_clean(), + 'body' => $body, 'title' => drupal_get_title(), 'headers' => array(), ), diff --git a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php index bae06fe..2831e75 100644 --- a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php @@ -37,7 +37,7 @@ class RequestCloseSubscriber implements EventSubscriberInterface { $response = $event->getResponse(); $config = config('system.performance'); - if ($config->get('cache') && ($cache = drupal_page_set_cache())) { + if ($config->get('cache') && ($cache = drupal_page_set_cache($event->getResponse()->getContent()))) { drupal_serve_page_from_cache($cache); } else { diff --git a/core/vendor/composer/autoload_namespaces.php b/core/vendor/composer/autoload_namespaces.php index e7a0e60..f3cf2d6 100644 --- a/core/vendor/composer/autoload_namespaces.php +++ b/core/vendor/composer/autoload_namespaces.php @@ -14,5 +14,6 @@ return array( 'Symfony\\Component\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/', 'Symfony\\Component\\DependencyInjection' => $vendorDir . '/symfony/dependency-injection/', 'Symfony\\Component\\ClassLoader' => $vendorDir . '/symfony/class-loader/', + 'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs', 'Doctrine\\Common' => $vendorDir . '/doctrine/common/lib/', ); diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 2e35827..e9d5e29 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -3,7 +3,7 @@ "name": "twig/twig", "version": "v1.8.3", "version_normalized": "1.8.3.0", - "time": "2012-06-18 01:48:16", + "time": "2012-06-18 09:48:16", "source": { "type": "git", "url": "git://github.com/fabpot/Twig.git", @@ -54,29 +54,34 @@ } }, { - "name": "symfony/dependency-injection", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/DependencyInjection", - "time": "2012-06-12 18:59:42", + "name": "symfony/class-loader", + "version": "v2.1.0-BETA4", + "version_normalized": "2.1.0.0-beta4", + "target-dir": "Symfony/Component/ClassLoader", + "time": "2012-07-15 14:13:51", "source": { "type": "git", - "url": "https://github.com/symfony/DependencyInjection", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/ClassLoader", + "reference": "v2.1.0-BETA4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/ClassLoader/zipball/v2.1.0-BETA4", + "reference": "v2.1.0-BETA4", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, - "suggest": { - "symfony/yaml": "v2.1.0-BETA1" + "require-dev": { + "symfony/finder": "2.1.*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -95,35 +100,48 @@ "role": null } ], - "description": "Symfony DependencyInjection Component", + "description": "Symfony ClassLoader Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\DependencyInjection": "" + "Symfony\\Component\\ClassLoader": "" } } }, { - "name": "symfony/event-dispatcher", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/EventDispatcher", - "time": "2012-05-15 23:56:32", + "name": "symfony/dependency-injection", + "version": "v2.1.0-BETA4", + "version_normalized": "2.1.0.0-beta4", + "target-dir": "Symfony/Component/DependencyInjection", + "time": "2012-07-15 14:13:51", "source": { "type": "git", - "url": "https://github.com/symfony/EventDispatcher", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/DependencyInjection", + "reference": "v2.1.0-BETA4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.0-BETA4", + "reference": "v2.1.0-BETA4", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/yaml": "2.1.*", + "symfony/config": "2.1.*" + }, + "suggest": { + "symfony/yaml": "v2.1.0-BETA4", + "symfony/config": "v2.1.0-BETA4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -142,35 +160,40 @@ "role": null } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony DependencyInjection Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\EventDispatcher": "" + "Symfony\\Component\\DependencyInjection": "" } } }, { "name": "symfony/http-foundation", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", + "version": "v2.1.0-BETA4", + "version_normalized": "2.1.0.0-beta4", "target-dir": "Symfony/Component/HttpFoundation", - "time": "2012-06-12 13:10:53", + "time": "2012-07-23 15:18:38", "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation", - "reference": "v2.1.0-BETA1" + "reference": "v2.1.0-BETA4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.0-BETA4", + "reference": "v2.1.0-BETA4", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -193,41 +216,44 @@ "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\HttpFoundation": "" + "Symfony\\Component\\HttpFoundation": "", + "SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs" } } }, { - "name": "symfony/http-kernel", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/HttpKernel", - "time": "2012-06-12 18:59:42", + "name": "symfony/event-dispatcher", + "version": "v2.1.0-BETA4", + "version_normalized": "2.1.0.0-beta4", + "target-dir": "Symfony/Component/EventDispatcher", + "time": "2012-07-20 03:18:14", "source": { "type": "git", - "url": "https://github.com/symfony/HttpKernel", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/EventDispatcher", + "reference": "v2.1.0-BETA4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/HttpKernel/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.0-BETA4", + "reference": "v2.1.0-BETA4", "shasum": "" }, "require": { - "php": ">=5.3.2", - "symfony/event-dispatcher": "self.version", - "symfony/http-foundation": "self.version" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/dependency-injection": "2.1.*" }, "suggest": { - "symfony/browser-kit": "v2.1.0-BETA1", - "symfony/class-loader": "v2.1.0-BETA1", - "symfony/config": "v2.1.0-BETA1", - "symfony/console": "v2.1.0-BETA1", - "symfony/dependency-injection": "v2.1.0-BETA1", - "symfony/finder": "v2.1.0-BETA1" + "symfony/dependency-injection": "v2.1.0-BETA4", + "symfony/http-kernel": "v2.1.0-BETA4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -246,39 +272,60 @@ "role": null } ], - "description": "Symfony HttpKernel Component", + "description": "Symfony EventDispatcher Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\HttpKernel": "" + "Symfony\\Component\\EventDispatcher": "" } } }, { - "name": "symfony/routing", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/Routing", - "time": "2012-06-12 18:59:42", + "name": "symfony/http-kernel", + "version": "v2.1.0-BETA4", + "version_normalized": "2.1.0.0-beta4", + "target-dir": "Symfony/Component/HttpKernel", + "time": "2012-07-23 21:10:10", "source": { "type": "git", - "url": "https://github.com/symfony/Routing", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/HttpKernel", + "reference": "v2.1.0-BETA4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Routing/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/HttpKernel/zipball/v2.1.0-BETA4", + "reference": "v2.1.0-BETA4", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3", + "symfony/event-dispatcher": "2.1.*", + "symfony/http-foundation": "2.1.*" + }, + "require-dev": { + "symfony/browser-kit": "2.1.*", + "symfony/class-loader": "2.1.*", + "symfony/config": "2.1.*", + "symfony/console": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/finder": "2.1.*", + "symfony/process": "2.1.*", + "symfony/routing": "2.1.*" }, "suggest": { - "symfony/config": "v2.1.0-BETA1", - "symfony/yaml": "v2.1.0-BETA1" + "symfony/browser-kit": "v2.1.0-BETA4", + "symfony/class-loader": "v2.1.0-BETA4", + "symfony/config": "v2.1.0-BETA4", + "symfony/console": "v2.1.0-BETA4", + "symfony/dependency-injection": "v2.1.0-BETA4", + "symfony/finder": "v2.1.0-BETA4" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -297,35 +344,51 @@ "role": null } ], - "description": "Symfony Routing Component", + "description": "Symfony HttpKernel Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\Routing": "" + "Symfony\\Component\\HttpKernel": "" } } }, { - "name": "symfony/yaml", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/Yaml", - "time": "2012-06-09 22:04:17", + "name": "symfony/routing", + "version": "v2.1.0-BETA4", + "version_normalized": "2.1.0.0-beta4", + "target-dir": "Symfony/Component/Routing", + "time": "2012-07-19 18:39:03", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/Routing", + "reference": "v2.1.0-BETA4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/Yaml/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/Routing/zipball/v2.1.0-BETA4", + "reference": "v2.1.0-BETA4", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/config": "2.1.*", + "symfony/yaml": "2.1.*", + "symfony/http-kernel": "2.1.*", + "doctrine/common": ">=2.2,<2.4-dev" + }, + "suggest": { + "symfony/config": "v2.1.0-BETA4", + "symfony/yaml": "v2.1.0-BETA4", + "doctrine/common": ">=2.2,<2.4-dev" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -344,35 +407,40 @@ "role": null } ], - "description": "Symfony Yaml Component", + "description": "Symfony Routing Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\Yaml": "" + "Symfony\\Component\\Routing": "" } } }, { - "name": "symfony/class-loader", - "version": "v2.1.0-BETA1", - "version_normalized": "2.1.0.0-beta1", - "target-dir": "Symfony/Component/ClassLoader", - "time": "2012-04-23 12:37:21", + "name": "symfony/yaml", + "version": "v2.1.0-BETA4", + "version_normalized": "2.1.0.0-beta4", + "target-dir": "Symfony/Component/Yaml", + "time": "2012-07-15 14:13:51", "source": { "type": "git", - "url": "https://github.com/symfony/ClassLoader", - "reference": "v2.1.0-BETA1" + "url": "https://github.com/symfony/Yaml", + "reference": "v2.1.0-BETA4" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/ClassLoader/zipball/v2.1.0-BETA1", - "reference": "v2.1.0-BETA1", + "url": "https://github.com/symfony/Yaml/zipball/v2.1.0-BETA4", + "reference": "v2.1.0-BETA4", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "installation-source": "dist", "license": [ "MIT" @@ -391,37 +459,42 @@ "role": null } ], - "description": "Symfony ClassLoader Component", + "description": "Symfony Yaml Component", "homepage": "http://symfony.com", "autoload": { "psr-0": { - "Symfony\\Component\\ClassLoader": "" + "Symfony\\Component\\Yaml": "" } } }, { "name": "doctrine/common", - "version": "2.2.2", - "version_normalized": "2.2.2.0", - "time": "2012-04-13 07:46:44", + "version": "2.3.0-BETA1", + "version_normalized": "2.3.0.0-beta1", + "time": "2012-07-16 12:58:02", "source": { "type": "git", "url": "https://github.com/doctrine/common", - "reference": "2.2.2" + "reference": "2.3.0-BETA1" }, "dist": { "type": "zip", - "url": "https://github.com/doctrine/common/zipball/2.2.2", - "reference": "2.2.2", + "url": "https://github.com/doctrine/common/zipball/2.3.0-BETA1", + "reference": "2.3.0-BETA1", "shasum": "" }, "require": { "php": ">=5.3.2" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, "installation-source": "dist", "license": [ - "LGPL" + "MIT" ], "authors": [ { @@ -451,7 +524,7 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "https://github.com/schmittjoh", + "homepage": "http://jmsyst.com", "role": null } ], diff --git a/core/vendor/doctrine/common/.travis.yml b/core/vendor/doctrine/common/.travis.yml index 4464d4f..fc05056 100644 --- a/core/vendor/doctrine/common/.travis.yml +++ b/core/vendor/doctrine/common/.travis.yml @@ -1,5 +1,10 @@ language: php +env: + - OPCODE_CACHE=apc + php: - 5.3 - 5.4 + +before_script: php ./bin/travis-setup.php $OPCODE_CACHE \ No newline at end of file diff --git a/core/vendor/doctrine/common/LICENSE b/core/vendor/doctrine/common/LICENSE index 1c03f74..4a91f0b 100644 --- a/core/vendor/doctrine/common/LICENSE +++ b/core/vendor/doctrine/common/LICENSE @@ -1,504 +1,19 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - +Copyright (c) 2006-2012 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. diff --git a/core/vendor/doctrine/common/bin/travis-setup.php b/core/vendor/doctrine/common/bin/travis-setup.php new file mode 100644 index 0000000..e9c355a --- /dev/null +++ b/core/vendor/doctrine/common/bin/travis-setup.php @@ -0,0 +1,141 @@ +. + */ + +/** + * Install PHP extensions required for testing by Travis CI. + * + * @author Victor Berchet + * @since 2.2 + */ +$installer = new PhpExtensions(); + +if (isset($argv[1]) && 'APC' === strtoupper($argv[1])) { + $installer->install('apc'); +} else { + $installer->install('xcache'); +} + +$installer->install('memcache'); +$installer->install('memcached'); + +class PhpExtensions +{ + protected $extensions; + protected $phpVersion; + protected $iniPath; + + public function __construct() + { + $this->phpVersion = phpversion(); + $this->iniPath = php_ini_loaded_file(); + $this->extensions = array( + 'memcache' => array( + 'url' => 'http://pecl.php.net/get/memcache-2.2.6.tgz', + 'php_version' => array(), + 'cfg' => array('--enable-memcache'), + 'ini' => array('extension=memcache.so'), + ), + 'memcached' => array( + 'url' => 'http://pecl.php.net/get/memcached-1.0.2.tgz', + 'php_version' => array( + // memcached 1.0.2 does not build on PHP 5.4 + array('<', '5.4'), + ), + 'cfg' => array(), + 'ini' => array('extension=memcached.so'), + ), + 'apc' => array( + 'url' => 'http://pecl.php.net/get/APC-3.1.9.tgz', + 'php_version' => array( + // apc 3.1.9 causes a segfault on PHP 5.4 + array('<', '5.4'), + ), + 'cfg' => array(), + 'ini' => array( + 'extension=apc.so', + 'apc.enabled=1', + 'apc.enable_cli=1' + ), + ), + 'xcache' => array( + 'url' => 'http://xcache.lighttpd.net/pub/Releases/1.2.2/xcache-1.2.2.tar.gz', + 'php_version' => array( + // xcache does not build with Travis CI (as of 2012-01-09) + array('<', '5'), + ), + 'cfg' => array('--enable-xcache'), + 'ini' => array( + 'extension=xcache.so', + 'xcache.cacher=false', + 'xcache.admin.enable_auth=0', + 'xcache.var_size=1M', + ), + ), + ); + } + + public function install($name) + { + if (array_key_exists($name, $this->extensions)) { + $extension = $this->extensions[$name]; + + + echo "== extension: $name ==\n"; + + foreach ($extension['php_version'] as $version) { + if (!version_compare($this->phpVersion, $version[1], $version[0])) { + printf( + "=> not installed, requires a PHP version %s %s (%s installed)\n", + $version[0], + $version[1], + $this->phpVersion + ); + + return; + } + } + + $this->system(sprintf("wget %s > /dev/null 2>&1", $extension['url'])); + $file = basename($extension['url']); + $this->system(sprintf("tar -xzf %s > /dev/null 2>&1", $file)); + $folder = basename($file, ".tgz"); + $folder = basename($folder, ".tar.gz"); + $this->system(sprintf( + 'sh -c "cd %s && phpize && ./configure %s && make && sudo make install" > /dev/null 2>&1', + $folder, + implode(' ', $extension['cfg']) + )); + foreach ($extension['ini'] as $ini) { + $this->system(sprintf("echo %s >> %s", $ini, $this->iniPath)); + } + printf("=> installed (%s)\n", $folder); + } + } + + private function system($cmd) + { + $ret = 0; + system($cmd, $ret); + if (0 !== $ret) { + printf("=> Command '%s' failed !", $cmd); + + exit($ret); + } + } +} diff --git a/core/vendor/doctrine/common/composer.json b/core/vendor/doctrine/common/composer.json index 7780d93..fe0388e 100644 --- a/core/vendor/doctrine/common/composer.json +++ b/core/vendor/doctrine/common/composer.json @@ -1,10 +1,10 @@ { "name": "doctrine/common", - "type": "library","version":"2.2.2", + "type": "library","version":"2.3.0-BETA1", "description": "Common Library for Doctrine projects", "keywords": ["collections", "spl", "eventmanager", "annotations", "persistence"], "homepage": "http://www.doctrine-project.org", - "license": "LGPL", + "license": "MIT", "authors": [ {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, {"name": "Roman Borschel", "email": "roman@code-factory.org"}, @@ -17,5 +17,10 @@ }, "autoload": { "psr-0": { "Doctrine\\Common": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php index 6251252..6a1390a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -52,6 +52,8 @@ class Annotation * Error handler for unknown property accessor in Annotation class. * * @param string $name Unknown property name + * + * @throws \BadMethodCallException */ public function __get($name) { @@ -65,6 +67,8 @@ class Annotation * * @param string $name Unkown property name * @param mixed $value Property value + * + * @throws \BadMethodCallException */ public function __set($name, $value) { @@ -72,4 +76,4 @@ class Annotation sprintf("Unknown property '%s' on annotation '%s'.", $name, get_class($this)) ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php index 21597b1..dbef6df 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -44,4 +44,4 @@ final class Attribute * @var boolean */ public $required = false; -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php index 6e314be..53134e3 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -34,4 +34,4 @@ final class Attributes * @var array */ public $value; -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php index 1b2b20a..a84a4f5 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -28,8 +28,18 @@ namespace Doctrine\Common\Annotations\Annotation; */ final class IgnoreAnnotation { + /** + * @var array + */ public $names; + /** + * Constructor + * + * @param array $values + * + * @throws \RuntimeException + */ public function __construct(array $values) { if (is_string($values['value'])) { @@ -41,4 +51,4 @@ final class IgnoreAnnotation $this->names = $values['value']; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php index 7b89a02..d67f960 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -30,4 +30,4 @@ namespace Doctrine\Common\Annotations\Annotation; */ final class Required { -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php index c41896a..64655ef 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -70,6 +70,8 @@ final class Target * Annotation construct * * @param array $values + * + * @throws \InvalidArgumentException */ public function __construct(array $values) { @@ -102,4 +104,4 @@ final class Target $this->value = $values['value']; $this->literal = implode(', ', $this->value); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php index fdc1913..109beeb 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -53,6 +53,22 @@ class AnnotationException extends \Exception } /** + * Creates a new AnnotationException describing a constant semantical error. + * + * @since 2.3 + * @param string $identifier + * @param string $context + * @return AnnotationException + */ + public static function semanticalErrorConstants($identifier, $context = null) + { + return self::semanticalError(sprintf( + "Couldn't find constant %s%s", $identifier, + $context ? ", $context." : "." + )); + } + + /** * Creates a new AnnotationException describing an error which occurred during * the creation of the annotation. * @@ -108,4 +124,4 @@ class AnnotationException extends \Exception $expected )); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php index dda8b23..5a1d253 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -35,7 +35,7 @@ use ReflectionProperty; * @author Roman Borschel * @author Johannes M. Schmitt */ -final class AnnotationReader implements Reader +class AnnotationReader implements Reader { /** * Global map for imports. @@ -60,14 +60,15 @@ final class AnnotationReader implements Reader 'subpackage'=> true, 'name'=> true, 'global'=> true, 'param'=> true, 'return'=> true, 'staticvar'=> true, 'category'=> true, 'staticVar'=> true, 'static'=> true, 'var'=> true, 'throws'=> true, 'inheritdoc'=> true, - 'inheritDoc'=> true, 'license'=> true, 'todo'=> true, 'deprecated'=> true, - 'deprec'=> true, 'author'=> true, 'property' => true, 'method' => true, + 'inheritDoc'=> true, 'license'=> true, 'todo'=> true, + 'deprec'=> true, 'property' => true, 'method' => true, 'abstract'=> true, 'exception'=> true, 'magic' => true, 'api' => true, 'final'=> true, 'filesource'=> true, 'throw' => true, 'uses' => true, 'usedby'=> true, 'private' => true, 'Annotation' => true, 'override' => true, 'codeCoverageIgnore' => true, 'codeCoverageIgnoreStart' => true, 'codeCoverageIgnoreEnd' => true, 'Required' => true, 'Attribute' => true, 'Attributes' => true, 'Target' => true, 'SuppressWarnings' => true, + 'ingroup' => true, 'code' => true, 'endcode' => true ); /** @@ -83,21 +84,21 @@ final class AnnotationReader implements Reader /** * Annotations Parser * - * @var Doctrine\Common\Annotations\DocParser + * @var \Doctrine\Common\Annotations\DocParser */ private $parser; /** * Annotations Parser used to collect parsing metadata * - * @var Doctrine\Common\Annotations\DocParser + * @var \Doctrine\Common\Annotations\DocParser */ private $preParser; /** * PHP Parser used to collect imports. * - * @var Doctrine\Common\Annotations\PhpParser + * @var \Doctrine\Common\Annotations\PhpParser */ private $phpParser; @@ -155,7 +156,7 @@ final class AnnotationReader implements Reader * @param ReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getClassAnnotation(ReflectionClass $class, $annotationName) { @@ -193,7 +194,7 @@ final class AnnotationReader implements Reader * * @param ReflectionProperty $property * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getPropertyAnnotation(ReflectionProperty $property, $annotationName) { @@ -211,8 +212,9 @@ final class AnnotationReader implements Reader /** * Gets the annotations applied to a method. * - * @param ReflectionMethod $property The ReflectionMethod of the method from which + * @param \ReflectionMethod $method The ReflectionMethod of the method from which * the annotations should be read. + * * @return array An array of Annotations. */ public function getMethodAnnotations(ReflectionMethod $method) @@ -231,7 +233,7 @@ final class AnnotationReader implements Reader * * @param ReflectionMethod $method * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getMethodAnnotation(ReflectionMethod $method, $annotationName) { @@ -262,6 +264,12 @@ final class AnnotationReader implements Reader return $this->ignoredAnnotationNames[$name]; } + /** + * Retrieve imports + * + * @param \ReflectionClass $class + * @return array + */ private function getImports(ReflectionClass $class) { if (isset($this->imports[$name = $class->getName()])) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php index 60b00f5..dfa846a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php @@ -13,12 +13,15 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ namespace Doctrine\Common\Annotations; +/** + * AnnotationRegistry + */ final class AnnotationRegistry { /** @@ -46,6 +49,11 @@ final class AnnotationRegistry self::$loaders = array(); } + /** + * Register file + * + * @param string $file + */ static public function registerFile($file) { require_once $file; @@ -77,26 +85,28 @@ final class AnnotationRegistry } /** - * Register an autoloading callabale for annotations, much like spl_autoload_register(). + * Register an autoloading callable for annotations, much like spl_autoload_register(). * * NOTE: These class loaders HAVE to be silent when a class was not found! * IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class. * - * @param callabale $callabale + * @param callable $callable + * + * @throws \InvalidArgumentException */ - static public function registerLoader($callabale) + static public function registerLoader($callable) { - if (!is_callable($callabale)) { + if (!is_callable($callable)) { throw new \InvalidArgumentException("A callable is expected in AnnotationRegistry::registerLoader()."); } - self::$loaders[] = $callabale; + self::$loaders[] = $callable; } /** * Autoload an annotation class silently. * * @param string $class - * @return void + * @return boolean */ static public function loadAnnotationClass($class) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php index 6ea47c6..e377e3b 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -29,6 +29,9 @@ use Doctrine\Common\Cache\Cache; */ final class CachedReader implements Reader { + /** + * @var string + */ private static $CACHE_SALT = '@[Annot]'; /** @@ -52,38 +55,48 @@ final class CachedReader implements Reader private $loadedAnnotations; /** + * Constructor + * * @param Reader $reader * @param Cache $cache + * @param bool $debug */ public function __construct(Reader $reader, Cache $cache, $debug = false) { $this->delegate = $reader; $this->cache = $cache; - $this->debug = $debug; + $this->debug = (Boolean) $debug; } + /** + * Get annotations for class + * + * @param \ReflectionClass $class + * @return array + */ public function getClassAnnotations(\ReflectionClass $class) { - $cacheKey = $class->getName() . self::$CACHE_SALT; + $cacheKey = $class->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } - // Attempt to grab data from cache - if (($data = $this->cache->fetch($cacheKey)) !== false) { - if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { - return $data; - } + if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) { + $annots = $this->delegate->getClassAnnotations($class); + $this->saveToCache($cacheKey, $annots); } - $annots = $this->delegate->getClassAnnotations($class); - $this->cache->save($cacheKey, $annots); - $this->cache->save('[C]'.$cacheKey, time()); - return $this->loadedAnnotations[$cacheKey] = $annots; } + /** + * Get selected annotation for class + * + * @param \ReflectionClass $class + * @param string $annotationName + * @return null + */ public function getClassAnnotation(\ReflectionClass $class, $annotationName) { foreach ($this->getClassAnnotations($class) as $annot) { @@ -95,29 +108,36 @@ final class CachedReader implements Reader return null; } + /** + * Get annotations for property + * + * @param \ReflectionProperty $property + * @return array + */ public function getPropertyAnnotations(\ReflectionProperty $property) { $class = $property->getDeclaringClass(); - $cacheKey = $class->getName().'$'.$property->getName().self::$CACHE_SALT; + $cacheKey = $class->getName().'$'.$property->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } - // Attempt to grab data from cache - if (($data = $this->cache->fetch($cacheKey)) !== false) { - if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { - return $data; - } + if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) { + $annots = $this->delegate->getPropertyAnnotations($property); + $this->saveToCache($cacheKey, $annots); } - $annots = $this->delegate->getPropertyAnnotations($property); - $this->cache->save($cacheKey, $annots); - $this->cache->save('[C]'.$cacheKey, time()); - return $this->loadedAnnotations[$cacheKey] = $annots; } + /** + * Get selected annotation for property + * + * @param \ReflectionProperty $property + * @param string $annotationName + * @return null + */ public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName) { foreach ($this->getPropertyAnnotations($property) as $annot) { @@ -129,29 +149,36 @@ final class CachedReader implements Reader return null; } + /** + * Get method annotations + * + * @param \ReflectionMethod $method + * @return array + */ public function getMethodAnnotations(\ReflectionMethod $method) { $class = $method->getDeclaringClass(); - $cacheKey = $class->getName().'#'.$method->getName().self::$CACHE_SALT; + $cacheKey = $class->getName().'#'.$method->getName(); if (isset($this->loadedAnnotations[$cacheKey])) { return $this->loadedAnnotations[$cacheKey]; } - // Attempt to grab data from cache - if (($data = $this->cache->fetch($cacheKey)) !== false) { - if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { - return $data; - } + if (false === ($annots = $this->fetchFromCache($cacheKey, $class))) { + $annots = $this->delegate->getMethodAnnotations($method); + $this->saveToCache($cacheKey, $annots); } - $annots = $this->delegate->getMethodAnnotations($method); - $this->cache->save($cacheKey, $annots); - $this->cache->save('[C]'.$cacheKey, time()); - return $this->loadedAnnotations[$cacheKey] = $annots; } + /** + * Get selected method annotation + * + * @param \ReflectionMethod $method + * @param string $annotationName + * @return null + */ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) { foreach ($this->getMethodAnnotations($method) as $annot) { @@ -163,11 +190,55 @@ final class CachedReader implements Reader return null; } + /** + * Clear loaded annotations + */ public function clearLoadedAnnotations() { $this->loadedAnnotations = array(); } + /** + * Fetches a value from the cache. + * + * @param string $rawCacheKey The cache key. + * @param \ReflectionClass $class The related class. + * @return mixed|boolean The cached value or false when the value is not in cache. + */ + private function fetchFromCache($rawCacheKey, \ReflectionClass $class) + { + $cacheKey = $rawCacheKey . self::$CACHE_SALT; + if (($data = $this->cache->fetch($cacheKey)) !== false) { + if (!$this->debug || $this->isCacheFresh($cacheKey, $class)) { + return $data; + } + } + + return false; + } + + /** + * Saves a value to the cache + * + * @param string $rawCacheKey The cache key. + * @param mixed $value The value. + */ + private function saveToCache($rawCacheKey, $value) + { + $cacheKey = $rawCacheKey . self::$CACHE_SALT; + $this->cache->save($cacheKey, $value); + if ($this->debug) { + $this->cache->save('[C]'.$cacheKey, time()); + } + } + + /** + * Check if cache is fresh + * + * @param string $cacheKey + * @param \ReflectionClass $class + * @return bool + */ private function isCacheFresh($cacheKey, \ReflectionClass $class) { if (false === $filename = $class->getFilename()) { @@ -176,4 +247,4 @@ final class CachedReader implements Reader return $this->cache->fetch('[C]'.$cacheKey) >= filemtime($filename); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php index c6223e3..fc3c2d4 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -33,11 +33,12 @@ use Doctrine\Common\Lexer; final class DocLexer extends Lexer { const T_NONE = 1; - const T_IDENTIFIER = 2; - const T_INTEGER = 3; - const T_STRING = 4; - const T_FLOAT = 5; + const T_INTEGER = 2; + const T_STRING = 3; + const T_FLOAT = 4; + // All tokens that are also identifiers should be >= 100 + const T_IDENTIFIER = 100; const T_AT = 101; const T_CLOSE_CURLY_BRACES = 102; const T_CLOSE_PARENTHESIS = 103; @@ -52,19 +53,19 @@ final class DocLexer extends Lexer const T_COLON = 112; /** - * @inheritdoc + * {@inheritdoc} */ protected function getCatchablePatterns() { return array( - '[a-z_][a-z0-9_:]*', + '[a-z_\\\][a-z0-9_\:\\\]*[a-z]{1}', '(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?', '"(?:[^"]|"")*"', ); } /** - * @inheritdoc + * {@inheritdoc} */ protected function getNonCatchablePatterns() { @@ -72,7 +73,11 @@ final class DocLexer extends Lexer } /** - * @inheritdoc + * {@inheritdoc} + * + * @param string $value + * + * @return int */ protected function getType(&$value) { @@ -127,7 +132,7 @@ final class DocLexer extends Lexer return self::T_COLON; default: - if (ctype_alpha($value[0]) || $value[0] === '_') { + if (ctype_alpha($value[0]) || $value[0] === '_' || $value[0] === '\\') { return self::T_IDENTIFIER; } @@ -137,4 +142,4 @@ final class DocLexer extends Lexer return $type; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php index 9d16b17..de31e0b 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -49,7 +49,7 @@ final class DocParser /** * The lexer. * - * @var Doctrine\Common\Annotations\DocLexer + * @var \Doctrine\Common\Annotations\DocLexer */ private $lexer; @@ -63,7 +63,7 @@ final class DocParser /** * Doc Parser used to collect annotation target * - * @var Doctrine\Common\Annotations\DocParser + * @var \Doctrine\Common\Annotations\DocParser */ private static $metadataParser; @@ -223,6 +223,11 @@ final class DocParser $this->ignoredAnnotationNames = $names; } + /** + * Sets ignore on not-imported annotations + * + * @param $bool + */ public function setIgnoreNotImportedAnnotations($bool) { $this->ignoreNotImportedAnnotations = (Boolean) $bool; @@ -230,7 +235,10 @@ final class DocParser /** * Sets the default namespaces. - * @param array $namespaces + * + * @param array $namespace + * + * @throws \RuntimeException */ public function addNamespace($namespace) { @@ -240,6 +248,12 @@ final class DocParser $this->namespaces[] = $namespace; } + /** + * Sets the imports + * + * @param array $imports + * @throws \RuntimeException + */ public function setImports(array $imports) { if ($this->namespaces) { @@ -287,7 +301,7 @@ final class DocParser * Attempts to match the given token with the current lookahead token. * If they match, updates the lookahead token; otherwise raises a syntax error. * - * @param int Token type. + * @param int $token type of Token. * @return bool True if tokens match; false otherwise. */ private function match($token) @@ -322,7 +336,8 @@ final class DocParser * * @param string $expected Expected string. * @param array $token Optional token. - * @throws SyntaxException + * + * @throws AnnotationException */ private function syntaxError($expected, $token = null) { @@ -372,7 +387,7 @@ final class DocParser /** * Collects parsing metadata for a given annotation class * - * @param string $name The annotation name + * @param string $name The annotation name */ private function collectAnnotationMetadata($name) { @@ -530,6 +545,7 @@ final class DocParser * NameSpacePart ::= identifier | null | false | true * SimpleName ::= identifier | null | false | true * + * @throws AnnotationException * @return mixed False if it is not a valid annotation. */ private function Annotation() @@ -537,20 +553,7 @@ final class DocParser $this->match(DocLexer::T_AT); // check if we have an annotation - if ($this->lexer->isNextTokenAny(self::$classIdentifiers)) { - $this->lexer->moveNext(); - $name = $this->lexer->token['value']; - } else if ($this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) { - $name = ''; - } else { - $this->syntaxError('namespace separator or identifier'); - } - - while ($this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen($this->lexer->token['value']) && $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) { - $this->match(DocLexer::T_NAMESPACE_SEPARATOR); - $this->matchAny(self::$classIdentifiers); - $name .= '\\'.$this->lexer->token['value']; - } + $name = $this->Identifier(); // only process names which are not fully qualified, yet // fully qualified names must start with a \ @@ -747,6 +750,91 @@ final class DocParser } /** + * Constant ::= integer | string | float | boolean + * + * @throws AnnotationException + * @return mixed + */ + private function Constant() + { + $identifier = $this->Identifier(); + + if (!defined($identifier) && false !== strpos($identifier, '::') && '\\' !== $identifier[0]) { + + list($className, $const) = explode('::', $identifier); + $alias = (false === $pos = strpos($className, '\\'))? $className : substr($className, 0, $pos); + + $found = false; + switch (true) { + case !empty ($this->namespaces): + foreach ($this->namespaces as $ns) { + if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { + $className = $ns.'\\'.$className; + $found = true; + break; + } + } + break; + + case isset($this->imports[$loweredAlias = strtolower($alias)]): + $found = true; + if (false !== $pos) { + $className = $this->imports[$loweredAlias].substr($className, $pos); + } else { + $className = $this->imports[$loweredAlias]; + } + break; + + default: + if(isset($this->imports['__NAMESPACE__'])) { + $ns = $this->imports['__NAMESPACE__']; + if (class_exists($ns.'\\'.$className) || interface_exists($ns.'\\'.$className)) { + $className = $ns.'\\'.$className; + $found = true; + } + } + break; + } + + if ($found) { + $identifier = $className . '::' . $const; + } + } + + if (!defined($identifier)) { + throw AnnotationException::semanticalErrorConstants($identifier, $this->context); + } + + return constant($identifier); + } + + /** + * Identifier ::= string + * + * @return string + */ + private function Identifier() + { + // check if we have an annotation + if ($this->lexer->isNextTokenAny(self::$classIdentifiers)) { + $this->lexer->moveNext(); + $className = $this->lexer->token['value']; + } else { + $this->syntaxError('namespace separator or identifier'); + } + + while ($this->lexer->lookahead['position'] === ($this->lexer->token['position'] + strlen($this->lexer->token['value'])) + && $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)) { + + $this->match(DocLexer::T_NAMESPACE_SEPARATOR); + $this->matchAny(self::$classIdentifiers); + $className .= '\\' . $this->lexer->token['value']; + } + + return $className; + } + + /** * Value ::= PlainValue | FieldAssignment * * @return mixed @@ -777,6 +865,10 @@ final class DocParser return $this->Annotation(); } + if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { + return $this->Constant(); + } + switch ($this->lexer->lookahead['type']) { case DocLexer::T_STRING: $this->match(DocLexer::T_STRING); @@ -867,8 +959,8 @@ final class DocParser /** * ArrayEntry ::= Value | KeyValuePair - * KeyValuePair ::= Key ("=" | ":") PlainValue - * Key ::= string | integer + * KeyValuePair ::= Key ("=" | ":") PlainValue | Constant + * Key ::= string | integer | Constant * * @return array */ @@ -878,9 +970,14 @@ final class DocParser if (DocLexer::T_EQUALS === $peek['type'] || DocLexer::T_COLON === $peek['type']) { - $this->matchAny(array(DocLexer::T_INTEGER, DocLexer::T_STRING)); - $key = $this->lexer->token['value']; + if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) { + $key = $this->Constant(); + } else { + $this->matchAny(array(DocLexer::T_INTEGER, DocLexer::T_STRING)); + $key = $this->lexer->token['value']; + } + $this->matchAny(array(DocLexer::T_EQUALS, DocLexer::T_COLON)); return array($key, $this->PlainValue()); @@ -888,4 +985,4 @@ final class DocParser return array(null, $this->Value()); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php index 4a42b58..3934861 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -32,10 +32,31 @@ class FileCacheReader implements Reader * @var Reader */ private $reader; + + /** + * @var string + */ private $dir; + + /** + * @var bool + */ private $debug; + + /** + * @var array + */ private $loadedAnnotations = array(); + /** + * Constructor + * + * @param Reader $reader + * @param string $cacheDir + * @param bool $debug + * + * @throws \InvalidArgumentException + */ public function __construct(Reader $reader, $cacheDir, $debug = false) { $this->reader = $reader; @@ -50,6 +71,12 @@ class FileCacheReader implements Reader $this->debug = $debug; } + /** + * Retrieve annotations for class + * + * @param \ReflectionClass $class + * @return array + */ public function getClassAnnotations(\ReflectionClass $class) { $key = $class->getName(); @@ -78,6 +105,12 @@ class FileCacheReader implements Reader return $this->loadedAnnotations[$key] = include $path; } + /** + * Get annotations for property + * + * @param \ReflectionProperty $property + * @return array + */ public function getPropertyAnnotations(\ReflectionProperty $property) { $class = $property->getDeclaringClass(); @@ -107,6 +140,12 @@ class FileCacheReader implements Reader return $this->loadedAnnotations[$key] = include $path; } + /** + * Retrieve annotations for method + * + * @param \ReflectionMethod $method + * @return array + */ public function getMethodAnnotations(\ReflectionMethod $method) { $class = $method->getDeclaringClass(); @@ -136,6 +175,12 @@ class FileCacheReader implements Reader return $this->loadedAnnotations[$key] = include $path; } + /** + * Save cache file + * + * @param string $path + * @param mixed $data + */ private function saveCacheFile($path, $data) { file_put_contents($path, 'loadedAnnotations = array(); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php index 1eea492..2dfdd4d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -28,13 +28,27 @@ use Doctrine\Common\Annotations\Reader; */ class IndexedReader implements Reader { + /** + * @var Reader + */ private $delegate; + /** + * Constructor + * + * @param Reader $reader + */ public function __construct(Reader $reader) { $this->delegate = $reader; } + /** + * Get Annotations for class + * + * @param \ReflectionClass $class + * @return array + */ public function getClassAnnotations(\ReflectionClass $class) { $annotations = array(); @@ -45,11 +59,24 @@ class IndexedReader implements Reader return $annotations; } + /** + * Get selected annotation for class + * + * @param \ReflectionClass $class + * @param string $annotation + * @return mixed + */ public function getClassAnnotation(\ReflectionClass $class, $annotation) { return $this->delegate->getClassAnnotation($class, $annotation); } + /** + * Get Annotations for method + * + * @param \ReflectionMethod $method + * @return array + */ public function getMethodAnnotations(\ReflectionMethod $method) { $annotations = array(); @@ -60,11 +87,24 @@ class IndexedReader implements Reader return $annotations; } + /** + * Get selected annotation for method + * + * @param \ReflectionMethod $method + * @param string $annotation + * @return mixed + */ public function getMethodAnnotation(\ReflectionMethod $method, $annotation) { return $this->delegate->getMethodAnnotation($method, $annotation); } + /** + * Get annotations for property + * + * @param \ReflectionProperty $property + * @return array + */ public function getPropertyAnnotations(\ReflectionProperty $property) { $annotations = array(); @@ -75,6 +115,13 @@ class IndexedReader implements Reader return $annotations; } + /** + * Get selected annotation for property + * + * @param \ReflectionProperty $property + * @param string $annotation + * @return mixed + */ public function getPropertyAnnotation(\ReflectionProperty $property, $annotation) { return $this->delegate->getPropertyAnnotation($property, $annotation); @@ -83,12 +130,12 @@ class IndexedReader implements Reader /** * Proxy all methods to the delegate. * - * @param type $method - * @param type $args - * @return type + * @param string $method + * @param array $args + * @return mixed */ public function __call($method, $args) { return call_user_func_array(array($this->delegate, $method), $args); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php index a14f8f5..c09dd51 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -30,34 +30,17 @@ use SplFileObject; final class PhpParser { /** - * The token list. - * - * @var array - */ - private $tokens; - - /** - * The number of tokens. - * - * @var int - */ - private $numTokens = 0; - - /** - * The current array pointer. - * - * @var int - */ - private $pointer = 0; - - /** * Parses a class. * - * @param \ReflectionClass $class A ReflectionClass object. - * @return array A list with use statements in the form (Alias => FQN). + * @param \ReflectionClass $class A ReflectionClass object. + * @return array A list with use statements in the form (Alias => FQN). */ public function parseClass(\ReflectionClass $class) { + if (method_exists($class, 'getUseStatements')) { + return $class->getUseStatements(); + } + if (false === $filename = $class->getFilename()) { return array(); } @@ -65,11 +48,9 @@ final class PhpParser $content = $this->getFileContent($filename, $class->getStartLine()); $namespace = str_replace('\\', '\\\\', $class->getNamespaceName()); $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); - $this->tokens = token_get_all('numTokens = count($this->tokens); - $this->pointer = 0; + $tokenizer = new TokenParser('parseUseStatements($class->getNamespaceName()); + $statements = $tokenizer->parseUseStatements($class->getNamespaceName()); return $statements; } @@ -77,8 +58,8 @@ final class PhpParser /** * Get the content of the file right up to the given line number. * - * @param string $filename The name of the file to load. - * @param int $lineNumber The number of lines to read from file. + * @param string $filename The name of the file to load. + * @param int $lineNumber The number of lines to read from file. * @return string The content of the file. */ private function getFileContent($filename, $lineNumber) @@ -86,7 +67,7 @@ final class PhpParser $content = ''; $lineCnt = 0; $file = new SplFileObject($filename); - while(!$file->eof()) { + while (!$file->eof()) { if ($lineCnt++ == $lineNumber) { break; } @@ -96,108 +77,4 @@ final class PhpParser return $content; } - - /** - * Gets the next non whitespace and non comment token. - * - * @return array The token if exists, null otherwise. - */ - private function next() - { - for ($i = $this->pointer; $i < $this->numTokens; $i++) { - $this->pointer++; - if ($this->tokens[$i][0] === T_WHITESPACE || - $this->tokens[$i][0] === T_COMMENT || - $this->tokens[$i][0] === T_DOC_COMMENT) { - - continue; - } - - return $this->tokens[$i]; - } - - return null; - } - - /** - * Get all use statements. - * - * @param string $namespaceName The namespace name of the reflected class. - * @return array A list with all found use statements. - */ - private function parseUseStatements($namespaceName) - { - $statements = array(); - while (($token = $this->next())) { - if ($token[0] === T_USE) { - $statements = array_merge($statements, $this->parseUseStatement()); - continue; - } else if ($token[0] !== T_NAMESPACE || $this->parseNamespace() != $namespaceName) { - continue; - } - - // Get fresh array for new namespace. This is to prevent the parser to collect the use statements - // for a previous namespace with the same name. This is the case if a namespace is defined twice - // or if a namespace with the same name is commented out. - $statements = array(); - } - - return $statements; - } - - /** - * Get the namespace name. - * - * @return string The found namespace name. - */ - private function parseNamespace() - { - $namespace = ''; - while (($token = $this->next())){ - if ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR) { - $namespace .= $token[1]; - } else { - break; - } - } - - return $namespace; - } - - /** - * Parse a single use statement. - * - * @return array A list with all found class names for a use statement. - */ - private function parseUseStatement() - { - $class = ''; - $alias = ''; - $statements = array(); - $explicitAlias = false; - while (($token = $this->next())) { - $isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR; - if (!$explicitAlias && $isNameToken) { - $class .= $token[1]; - $alias = $token[1]; - } else if ($explicitAlias && $isNameToken) { - $alias .= $token[1]; - } else if ($token[0] === T_AS) { - $explicitAlias = true; - $alias = ''; - } else if ($token === ',') { - $statements[strtolower($alias)] = $class; - $class = ''; - $alias = ''; - $explicitAlias = false; - } else if ($token === ';') { - $statements[strtolower($alias)] = $class; - break; - } else { - break; - } - } - - return $statements; - } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php index 8e85d39..6a01cb4 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Reader.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -26,10 +26,42 @@ namespace Doctrine\Common\Annotations; */ interface Reader { + /** + * @param \ReflectionClass $class + * @return mixed + */ function getClassAnnotations(\ReflectionClass $class); + + /** + * @param \ReflectionClass $class + * @param string $annotationName + * @return mixed + */ function getClassAnnotation(\ReflectionClass $class, $annotationName); + + /** + * @param \ReflectionMethod $method + * @return mixed + */ function getMethodAnnotations(\ReflectionMethod $method); + + /** + * @param \ReflectionMethod $method + * @param string $annotationName + * @return mixed + */ function getMethodAnnotation(\ReflectionMethod $method, $annotationName); + + /** + * @param \ReflectionProperty $property + * @return mixed + */ function getPropertyAnnotations(\ReflectionProperty $property); + + /** + * @param \ReflectionProperty $property + * @param string $annotationName + * @return mixed + */ function getPropertyAnnotation(\ReflectionProperty $property, $annotationName); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php index a13c7fa..4210d90 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -62,8 +62,9 @@ class SimpleAnnotationReader implements Reader /** * Gets the annotations applied to a class. * - * @param ReflectionClass $class The ReflectionClass of the class from which + * @param \ReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. + * * @return array An array of Annotations. */ public function getClassAnnotations(\ReflectionClass $class) @@ -71,11 +72,12 @@ class SimpleAnnotationReader implements Reader return $this->parser->parse($class->getDocComment(), 'class '.$class->getName()); } - /** + /** * Gets the annotations applied to a method. * - * @param ReflectionMethod $property The ReflectionMethod of the method from which + * @param \ReflectionMethod $method The ReflectionMethod of the method from which * the annotations should be read. + * * @return array An array of Annotations. */ public function getMethodAnnotations(\ReflectionMethod $method) @@ -86,8 +88,9 @@ class SimpleAnnotationReader implements Reader /** * Gets the annotations applied to a property. * - * @param ReflectionProperty $property The ReflectionProperty of the property + * @param \ReflectionProperty $property The ReflectionProperty of the property * from which the annotations should be read. + * * @return array An array of Annotations. */ public function getPropertyAnnotations(\ReflectionProperty $property) @@ -98,10 +101,11 @@ class SimpleAnnotationReader implements Reader /** * Gets a class annotation. * - * @param ReflectionClass $class The ReflectionClass of the class from which + * @param \ReflectionClass $class The ReflectionClass of the class from which * the class annotations should be read. * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getClassAnnotation(\ReflectionClass $class, $annotationName) { @@ -117,9 +121,10 @@ class SimpleAnnotationReader implements Reader /** * Gets a method annotation. * - * @param ReflectionMethod $method + * @param \ReflectionMethod $method * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getMethodAnnotation(\ReflectionMethod $method, $annotationName) { @@ -135,9 +140,9 @@ class SimpleAnnotationReader implements Reader /** * Gets a property annotation. * - * @param ReflectionProperty $property + * @param \ReflectionProperty $property * @param string $annotationName The name of the annotation. - * @return The Annotation or NULL, if the requested annotation does not exist. + * @return mixed The Annotation or NULL, if the requested annotation does not exist. */ public function getPropertyAnnotation(\ReflectionProperty $property, $annotationName) { @@ -149,4 +154,4 @@ class SimpleAnnotationReader implements Reader return null; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/TokenParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/TokenParser.php new file mode 100644 index 0000000..a1ef115 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/TokenParser.php @@ -0,0 +1,175 @@ +. + */ + +namespace Doctrine\Common\Annotations; + +/** + * Parses a file for namespaces/use/class declarations. + * + * @author Fabien Potencier + * @author Christian Kaps + */ +class TokenParser +{ + /** + * The token list. + * + * @var array + */ + private $tokens; + + /** + * The number of tokens. + * + * @var int + */ + private $numTokens = 0; + + /** + * The current array pointer. + * + * @var int + */ + private $pointer = 0; + + public function __construct($contents) + { + $this->tokens = token_get_all($contents); + $this->numTokens = count($this->tokens); + $this->pointer = 0; + } + + /** + * Gets the next non whitespace and non comment token. + * + * @param $docCommentIsComment + * If TRUE then a doc comment is considered a comment and skipped. + * If FALSE then only whitespace and normal comments are skipped. + * + * @return array The token if exists, null otherwise. + */ + public function next($docCommentIsComment = TRUE) + { + for ($i = $this->pointer; $i < $this->numTokens; $i++) { + $this->pointer++; + if ($this->tokens[$i][0] === T_WHITESPACE || + $this->tokens[$i][0] === T_COMMENT || + ($docCommentIsComment && $this->tokens[$i][0] === T_DOC_COMMENT)) { + + continue; + } + + return $this->tokens[$i]; + } + + return null; + } + + /** + * Parse a single use statement. + * + * @return array A list with all found class names for a use statement. + */ + public function parseUseStatement() + { + $class = ''; + $alias = ''; + $statements = array(); + $explicitAlias = false; + while (($token = $this->next())) { + $isNameToken = $token[0] === T_STRING || $token[0] === T_NS_SEPARATOR; + if (!$explicitAlias && $isNameToken) { + $class .= $token[1]; + $alias = $token[1]; + } else if ($explicitAlias && $isNameToken) { + $alias .= $token[1]; + } else if ($token[0] === T_AS) { + $explicitAlias = true; + $alias = ''; + } else if ($token === ',') { + $statements[strtolower($alias)] = $class; + $class = ''; + $alias = ''; + $explicitAlias = false; + } else if ($token === ';') { + $statements[strtolower($alias)] = $class; + break; + } else { + break; + } + } + + return $statements; + } + + /** + * Get all use statements. + * + * @param string $namespaceName The namespace name of the reflected class. + * @return array A list with all found use statements. + */ + public function parseUseStatements($namespaceName) + { + $statements = array(); + while (($token = $this->next())) { + if ($token[0] === T_USE) { + $statements = array_merge($statements, $this->parseUseStatement()); + continue; + } + if ($token[0] !== T_NAMESPACE || $this->parseNamespace() != $namespaceName) { + continue; + } + + // Get fresh array for new namespace. This is to prevent the parser to collect the use statements + // for a previous namespace with the same name. This is the case if a namespace is defined twice + // or if a namespace with the same name is commented out. + $statements = array(); + } + + return $statements; + } + + /** + * Get the namespace. + * + * @return string The found namespace. + */ + public function parseNamespace() + { + $name = ''; + while (($token = $this->next()) && ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR)) { + $name .= $token[1]; + } + + return $name; + } + + /** + * Get the class name. + * + * @return string The foundclass name. + */ + public function parseClass() + { + // Namespaces and class names are tokenized the same: T_STRINGs + // separated by T_NS_SEPARATOR so we can use one function to provide + // both. + return $this->parseNamespace(); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php index a59296f..2d0cd23 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -47,11 +47,7 @@ class ApcCache extends CacheProvider */ protected function doContains($id) { - $found = false; - - apc_fetch($id, $found); - - return $found; + return apc_exists($id); } /** @@ -94,4 +90,4 @@ class ApcCache extends CacheProvider Cache::STATS_MEMORY_AVAILIABLE => $sma['avail_mem'], ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php index 8a0b982..a7a70aa 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -93,4 +93,4 @@ class ArrayCache extends CacheProvider { return null; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php index d303bde..5493562 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -45,7 +45,7 @@ interface 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. + * @return mixed The cached data or FALSE, if no cache entry exists for the given id. */ function fetch($id); @@ -61,7 +61,7 @@ interface Cache * Puts data into the cache. * * @param string $id The cache id. - * @param string $data The cache entry/data. + * @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). * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php index fa11fc2..4221a62 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -40,6 +40,11 @@ abstract class CacheProvider implements Cache private $namespace = ''; /** + * @var string The namespace version + */ + private $namespaceVersion; + + /** * Set the namespace to prefix all cache ids with. * * @param string $namespace @@ -117,10 +122,12 @@ abstract class CacheProvider implements Cache */ public function deleteAll() { - $namespaceCacheKey = sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); - $namespaceVersion = ($this->doContains($namespaceCacheKey)) ? $this->doFetch($namespaceCacheKey) : 1; + $namespaceCacheKey = $this->getNamespaceCacheKey(); + $namespaceVersion = $this->getNamespaceVersion() + 1; - return $this->doSave($namespaceCacheKey, $namespaceVersion + 1); + $this->namespaceVersion = $namespaceVersion; + + return $this->doSave($namespaceCacheKey, $namespaceVersion); } /** @@ -131,13 +138,47 @@ abstract class CacheProvider implements Cache */ private function getNamespacedId($id) { - $namespaceCacheKey = sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); - $namespaceVersion = ($this->doContains($namespaceCacheKey)) ? $this->doFetch($namespaceCacheKey) : 1; + $namespaceVersion = $this->getNamespaceVersion(); return sprintf('%s[%s][%s]', $this->namespace, $id, $namespaceVersion); } /** + * Namespace cache key + * + * @return string $namespaceCacheKey + */ + private function getNamespaceCacheKey() + { + return sprintf(self::DOCTRINE_NAMESPACE_CACHEKEY, $this->namespace); + } + + /** + * Namespace version + * + * @return string $namespaceVersion + */ + private function getNamespaceVersion() + { + if (null !== $this->namespaceVersion) { + return $this->namespaceVersion; + } + + $namespaceCacheKey = $this->getNamespaceCacheKey(); + $namespaceVersion = $this->doFetch($namespaceCacheKey); + + if (false === $namespaceVersion) { + $namespaceVersion = 1; + + $this->doSave($namespaceCacheKey, $namespaceVersion); + } + + $this->namespaceVersion = $namespaceVersion; + + return $this->namespaceVersion; + } + + /** * Fetches an entry from the cache. * * @param string $id cache id The id of the cache entry to fetch. @@ -158,7 +199,9 @@ abstract class CacheProvider implements Cache * * @param string $id The cache id. * @param string $data The cache entry/data. - * @param int $lifeTime The lifetime. If != false, sets a specific lifetime for this cache entry (null => infinite lifeTime). + * @param bool|int $lifeTime The lifetime. If != false, sets a specific lifetime for this + * cache entry (null => infinite lifeTime). + * * @return boolean TRUE if the entry was successfully stored in the cache, FALSE otherwise. */ abstract protected function doSave($id, $data, $lifeTime = false); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php new file mode 100644 index 0000000..4435975 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php @@ -0,0 +1,132 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Base file cache driver. + * + * @since 2.3 + * @author Fabio B. Silva + */ +abstract class FileCache extends CacheProvider +{ + /** + * @var string Cache directory. + */ + protected $directory; + + /** + * @var string Cache file extension. + */ + protected $extension; + + /** + * Constructor + * + * @param string $directory Cache directory. + * @param string $directory Cache file extension. + * + * @throws \InvalidArgumentException + */ + public function __construct($directory, $extension = null) + { + if ( ! is_dir($directory) && ! @mkdir($directory, 0777, true)) { + throw new \InvalidArgumentException(sprintf( + 'The directory "%s" does not exist and could not be created.', + $directory + )); + } + + if ( ! is_writable($directory)) { + throw new \InvalidArgumentException(sprintf( + 'The directory "%s" is not writable.', + $directory + )); + } + + $this->directory = realpath($directory); + $this->extension = $extension ?: $this->extension; + } + + /** + * Gets the cache directory. + * + * @return string + */ + public function getDirectory() + { + return $this->directory; + } + + /** + * Gets the cache file extension. + * + * @return string + */ + public function getExtension() + { + return $this->extension; + } + + /** + * @return string + */ + protected function getFilename($id) + { + $path = implode(str_split(md5($id), 12), DIRECTORY_SEPARATOR); + $path = $this->directory . DIRECTORY_SEPARATOR . $path; + + return $path . DIRECTORY_SEPARATOR . $id . $this->extension; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return unlink($this->getFilename($id)); + } + + /** + * {@inheritdoc} + */ + 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) { + unlink($name); + } + + return true; + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + return null; + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php new file mode 100644 index 0000000..a27a717 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php @@ -0,0 +1,114 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Filesystem cache driver. + * + * @since 2.3 + * @author Fabio B. Silva + */ +class FilesystemCache extends FileCache +{ + const EXTENSION = '.doctrinecache.data'; + + /** + * {@inheritdoc} + */ + protected $extension = self::EXTENSION; + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $data = ''; + $lifetime = -1; + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + if ($lifetime !== 0 && $lifetime < time()) { + fclose($resource); + + return false; + } + + while (false !== ($line = fgets($resource))) { + $data .= $line; + } + + fclose($resource); + + return unserialize($data); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + $lifetime = -1; + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + fclose($resource); + + return $lifetime === 0 || $lifetime > time(); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + $lifeTime = time() + $lifeTime; + } + + $data = serialize($data); + $filename = $this->getFilename($id); + $filepath = pathinfo($filename, PATHINFO_DIRNAME); + + if ( ! is_dir($filepath)) { + mkdir($filepath, 0777, true); + } + + return file_put_contents($filename, $lifeTime . PHP_EOL . $data); + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php index dd6d1e3..5687b96 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php index 4675fae..75f1345 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php new file mode 100644 index 0000000..0971cd9 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php @@ -0,0 +1,108 @@ +. + */ + +namespace Doctrine\Common\Cache; + +/** + * Php file cache driver. + * + * @since 2.3 + * @author Fabio B. Silva + */ +class PhpFileCache extends FileCache +{ + const EXTENSION = '.doctrinecache.php'; + + /** + * {@inheritdoc} + */ + protected $extension = self::EXTENSION; + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $value = include $filename; + + if ($value['lifetime'] !== 0 && $value['lifetime'] < time()) { + return false; + } + + return $value['data']; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + $filename = $this->getFilename($id); + + if ( ! file_exists($filename)) { + return false; + } + + $value = include $filename; + + return $value['lifetime'] === 0 || $value['lifetime'] > time(); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 0) { + $lifeTime = time() + $lifeTime; + } + + if (is_object($data) && ! method_exists($data, '__set_state')) { + throw new \InvalidArgumentException( + "Invalid argument given, PhpFileCache only allows objects that implement __set_state() " . + "and fully support var_export(). You can use the FilesystemCache to save arbitrary object " . + "graphs using serialize()/deserialize()." + ); + } + + $filename = $this->getFilename($id); + $filepath = pathinfo($filename, PATHINFO_DIRNAME); + + if ( ! is_dir($filepath)) { + mkdir($filepath, 0777, true); + } + + $value = array( + 'lifetime' => $lifeTime, + 'data' => $data + ); + + $value = var_export($value, true); + $code = sprintf('. + */ + +namespace Doctrine\Common\Cache; + +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 + */ +class RedisCache extends CacheProvider +{ + /** + * @var Redis + */ + private $redis; + + /** + * Sets the redis instance to use. + * + * @param Redis $redis + */ + public function setRedis(Redis $redis) + { + $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY); + $this->redis = $redis; + } + + /** + * Gets the redis instance used by the cache. + * + * @return Redis + */ + public function getRedis() + { + return $this->redis; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->redis->get($id); + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return $this->redis->exists($id); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + $result = $this->redis->set($id, $data); + if ($lifeTime > 0) { + $this->redis->expire($id, $lifeTime); + } + return $result; + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->redis->delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->redis->flushDB(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $info = $this->redis->info(); + return array( + 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 + ); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php index ed8ca74..777d0fd 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -32,7 +32,7 @@ namespace Doctrine\Common\Cache; * @author Roman Borschel * @author David Abdemoulaie */ -class WincacheCache extends CacheProvider +class WinCacheCache extends CacheProvider { /** * {@inheritdoc} @@ -79,14 +79,15 @@ class WincacheCache extends CacheProvider */ protected function doGetStats() { - $info = wincache_ucache_info(); - $meminfo= wincache_ucache_meminfo(); + $info = wincache_ucache_info(); + $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_AVAILIABLE => $meminfo['memory_free'], ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php index 6e22d26..8733e26 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -107,4 +107,4 @@ class XcacheCache extends CacheProvider Cache::STATS_MEMORY_AVAILIABLE => $info['avail'], ); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php index 4e4dabe..fc90bc6 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php index 375b0d6..45024e1 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -149,7 +149,8 @@ class ClassLoader /** * Loads the given class or interface. * - * @param string $classname The name of the class to load. + * @param string $className The name of the class to load. + * @return boolean TRUE if the class has been successfully loaded, FALSE otherwise. */ public function loadClass($className) @@ -244,7 +245,7 @@ class ClassLoader * for (and is able to load) the class with the given name. * * @param string $className The name of the class. - * @return The ClassLoader for the class or NULL if no such ClassLoader exists. + * @return ClassLoader The ClassLoader for the class or NULL if no such ClassLoader exists. */ public static function getClassLoader($className) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php index 2a7d4ea..a075c08 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php @@ -13,13 +13,15 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ namespace Doctrine\Common\Collections; use Closure, ArrayIterator; +use Doctrine\Common\Collections\Expr\Expression; +use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor; /** * An ArrayCollection is a Collection implementation that wraps a regular PHP array. @@ -29,7 +31,7 @@ use Closure, ArrayIterator; * @author Jonathan Wage * @author Roman Borschel */ -class ArrayCollection implements Collection +class ArrayCollection implements Collection, Selectable { /** * An array containing the entries of this collection. @@ -151,6 +153,9 @@ class ArrayCollection implements Collection * ArrayAccess implementation of offsetExists() * * @see containsKey() + * + * @param mixed $offset + * @return bool */ public function offsetExists($offset) { @@ -161,6 +166,9 @@ class ArrayCollection implements Collection * ArrayAccess implementation of offsetGet() * * @see get() + * + * @param mixed $offset + * @return mixed */ public function offsetGet($offset) { @@ -168,10 +176,14 @@ class ArrayCollection implements Collection } /** - * ArrayAccess implementation of offsetGet() + * ArrayAccess implementation of offsetSet() * * @see add() * @see set() + * + * @param mixed $offset + * @param mixed $value + * @return bool */ public function offsetSet($offset, $value) { @@ -185,6 +197,9 @@ class ArrayCollection implements Collection * ArrayAccess implementation of offsetUnset() * * @see remove() + * + * @param mixed $offset + * @return mixed */ public function offsetUnset($offset) { @@ -224,7 +239,7 @@ class ArrayCollection implements Collection } /** - * Tests for the existance of an element that satisfies the given predicate. + * Tests for the existence of an element that satisfies the given predicate. * * @param Closure $p The predicate. * @return boolean TRUE if the predicate is TRUE for at least one element, FALSE otherwise. @@ -328,7 +343,7 @@ class ArrayCollection implements Collection /** * Checks whether the collection is empty. * - * Note: This is preferrable over count() == 0. + * Note: This is preferable over count() == 0. * * @return boolean TRUE if the collection is empty, FALSE otherwise. */ @@ -444,4 +459,52 @@ class ArrayCollection implements Collection { return array_slice($this->_elements, $offset, $length, true); } + + /** + * Select all elements from a selectable that match the criteria and + * return a new collection containing these elements. + * + * @param Criteria $criteria + * @return Collection + */ + public function matching(Criteria $criteria) + { + $expr = $criteria->getWhereExpression(); + $filtered = $this->_elements; + + if ($expr) { + $visitor = new ClosureExpressionVisitor(); + $filter = $visitor->dispatch($expr); + $filtered = array_filter($filtered, $filter); + } + + if ($orderings = $criteria->getOrderings()) { + $next = null; + foreach (array_reverse($orderings) as $field => $ordering) { + $next = ClosureExpressionVisitor::sortByField($field, $ordering == 'DESC' ? -1 : 1, $next); + } + + usort($filtered, $next); + } + + $offset = $criteria->getFirstResult(); + $length = $criteria->getMaxResults(); + + if ($offset || $length) { + $filtered = array_slice($filtered, (int)$offset, $length); + } + + return new static($filtered); + } + + /** + * Return the expression builder. + * + * @return ExpressionBuilder + */ + public function expr() + { + return new ExpressionBuilder(); + } } + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php index 9fca659..51eb9e7 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -240,4 +240,4 @@ interface Collection extends Countable, IteratorAggregate, ArrayAccess * @return array */ function slice($offset, $length = null); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php new file mode 100644 index 0000000..6eb52e5 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php @@ -0,0 +1,171 @@ +. + */ + +namespace Doctrine\Common\Collections; + +use Doctrine\Common\Collections\Expr\Expression; + +/** + * Criteria for filtering Selectable collections. + * + * @author Benjamin Eberlei + * @since 2.3 + */ +class Criteria +{ + /** + * @var string + */ + const ASC = 'ASC'; + + /** + * @var string + */ + const DESC = 'DESC'; + + /** + * @var \Doctrine\Common\Collections\Expr\Expression + */ + private $expression; + + /** + * @var array|null + */ + private $orderings; + + /** + * @var int + */ + private $firstResult; + + /** + * @var int + */ + private $maxResults; + + /** + * Construct new criteria + * + * @param Expression $expression + * @param array $orderings + * @param int $firstResult + * @param int $maxResults + */ + public function __construct(Expression $expression = null, array $orderings = null, $firstResult = null, $maxResults = null) + { + $this->expression = $expression; + $this->orderings = $orderings; + $this->firstResult = $firstResult; + $this->maxResults = $maxResults; + } + + /** + * Set the where expression to evaluate when this criteria is searched for. + * + * @param Expression + * @return Criteria + */ + public function where(Expression $expression) + { + $this->expression = $expression; + return $this; + } + + /** + * Get the expression attached to this criteria. + * + * @return Expression|null + */ + public function getWhereExpression() + { + return $this->expression; + } + + /** + * Get current orderings of this Criteria + * + * @return array + */ + public function getOrderings() + { + return $this->orderings; + } + + /** + * Set the ordering of the result of this criteria. + * + * Keys are field and values are the order, being either ASC or DESC. + * + * @see Criteria::ASC + * @see Criteria::DESC + * + * @param array + * @return Criteria + */ + public function orderBy(array $orderings) + { + $this->orderings = $orderings; + return $this; + } + + /** + * Get current first result option of the critera. + * + * @return firstResult. + */ + public function getFirstResult() + { + return $this->firstResult; + } + + /** + * Set number of first result that this criteria should return. + * + * @param firstResult the value to set. + * @return Criteria + */ + public function setFirstResult($firstResult) + { + $this->firstResult = $firstResult; + return $this; + } + + /** + * Get maxResults. + * + * @return maxResults. + */ + public function getMaxResults() + { + return $this->maxResults; + } + + /** + * Set maxResults. + * + * @param maxResults the value to set. + * @return Criteria + */ + public function setMaxResults($maxResults) + { + $this->maxResults = $maxResults; + return $this; + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php new file mode 100644 index 0000000..06ccb04 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php @@ -0,0 +1,195 @@ +. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Walks an expression graph and turns it into a PHP closure. + * + * This closure can be used with {@Collection#filter()} and is used internally + * by {@ArrayCollection#select()}. + * + * @author Benjamin Eberlei + * @since 2.3 + */ +class ClosureExpressionVisitor extends ExpressionVisitor +{ + /** + * Access the field of a given object. This field has to be public directly + * or indirectly (through an accessor get* or a magic method, __get, __call). + * + * is*() is not supported. + * + * @return mixed + */ + static public function getObjectFieldValue($object, $field) + { + $accessor = "get" . $field; + + if (method_exists($object, $accessor) || method_exists($object, '__call')) { + return $object->$accessor(); + } + + if ($object instanceof \ArrayAccess) { + return $object[$field]; + } + + return $object->$field; + } + + /** + * Helper for sorting arrays of objects based on multiple fields + + * orientations. + * + * @param string $name + * @param int $orientation + * @param Closure $next + * @return Closure + */ + static public function sortByField($name, $orientation = 1, \Closure $next = null) + { + if (!$next) { + $next = function() { + return 0; + }; + } + + return function ($a, $b) use ($name, $next, $orientation) { + $aValue = ClosureExpressionVisitor::getObjectFieldValue($a, $name); + $bValue = ClosureExpressionVisitor::getObjectFieldValue($b, $name); + + if ($aValue === $bValue) { + return $next($a, $b); + } + + return (($aValue > $bValue) ? 1 : -1) * $orientation; + }; + } + + /** + * {@inheritDoc} + */ + public function walkComparison(Comparison $comparison) + { + $field = $comparison->getField(); + $value = $comparison->getValue()->getValue(); // shortcut for walkValue() + + switch ($comparison->getOperator()) { + case Comparison::EQ: + case Comparison::IS: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) === $value; + }; + + case Comparison::NEQ: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) !== $value; + }; + + case Comparison::LT: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) < $value; + }; + + case Comparison::LTE: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) <= $value; + }; + + case Comparison::GT: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) > $value; + }; + + case Comparison::GTE: + return function ($object) use ($field, $value) { + return ClosureExpressionVisitor::getObjectFieldValue($object, $field) >= $value; + }; + + case Comparison::IN: + return function ($object) use ($field, $value) { + return in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); + }; + + case Comparison::NIN: + return function ($object) use ($field, $value) { + return ! in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); + }; + + default: + throw new \RuntimeException("Unknown comparison operator: " . $comparison->getOperator()); + } + } + + /** + * {@inheritDoc} + */ + public function walkValue(Value $value) + { + return $value->getValue(); + } + + /** + * {@inheritDoc} + */ + public function walkCompositeExpression(CompositeExpression $expr) + { + $expressionList = array(); + + foreach ($expr->getExpressionList() as $child) { + $expressionList[] = $this->dispatch($child); + } + + switch($expr->getType()) { + case CompositeExpression::TYPE_AND: + return $this->andExpressions($expressionList); + + case CompositeExpression::TYPE_OR: + return $this->orExpressions($expressionList); + + default: + throw new \RuntimeException("Unknown composite " . $expr->getType()); + } + } + + private function andExpressions($expressions) + { + return function ($object) use ($expressions) { + foreach ($expressions as $expression) { + if ( ! $expression($object)) { + return false; + } + } + return true; + }; + } + + private function orExpressions($expressions) + { + return function ($object) use ($expressions) { + foreach ($expressions as $expression) { + if ($expression($object)) { + return true; + } + } + return false; + }; + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php new file mode 100644 index 0000000..29cfcff --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php @@ -0,0 +1,75 @@ +. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Comparison of a field with a value by the given operator. + * + * @author Benjamin Eberlei + * @since 2.3 + */ +class Comparison implements Expression +{ + const EQ = '='; + const NEQ = '<>'; + const LT = '<'; + const LTE = '<='; + const GT = '>'; + const GTE = '>='; + const IS = 'IS'; + const IN = 'IN'; + const NIN = 'NIN'; + + private $field; + private $op; + private $value; + + public function __construct($field, $operator, $value) + { + if ( ! ($value instanceof Value)) { + $value = new Value($value); + } + + $this->field = $field; + $this->op = $operator; + $this->value = $value; + } + + public function getField() + { + return $this->field; + } + + public function getValue() + { + return $this->value; + } + + public function getOperator() + { + return $this->op; + } + + public function visit(ExpressionVisitor $visitor) + { + return $visitor->walkComparison($this); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php new file mode 100644 index 0000000..fe917cf --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php @@ -0,0 +1,72 @@ +. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Expression of Expressions combined by AND or OR operation. + * + * @author Benjamin Eberlei + * @since 2.3 + */ +class CompositeExpression implements Expression +{ + const TYPE_AND = 'AND'; + const TYPE_OR = 'OR'; + + private $type; + private $expressions = array(); + + public function __construct($type, array $expressions) + { + $this->type = $type; + + foreach ($expressions as $expr) { + if ($expr instanceof Value) { + throw new \RuntimeException("Values are not supported expressions as children of and/or expressions."); + } + if ( ! ($expr instanceof Expression)) { + throw new \RuntimeException("No expression given to CompositeExpression."); + } + + $this->expressions[] = $expr; + } + } + + /** + * Return the list of expressions nested in this composite. + * + * @return Expression[] + */ + public function getExpressionList() + { + return $this->expressions; + } + + public function getType() + { + return $this->type; + } + + public function visit(ExpressionVisitor $visitor) + { + return $visitor->walkCompositeExpression($this); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php new file mode 100644 index 0000000..b0762ad --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php @@ -0,0 +1,31 @@ +. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * Expression for the {@link Selectable} interface. + * + * @author Benjamin Eberlei + */ +interface Expression +{ + public function visit(ExpressionVisitor $visitor); +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php new file mode 100644 index 0000000..5e69b98 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php @@ -0,0 +1,81 @@ +. + */ + +namespace Doctrine\Common\Collections\Expr; + +/** + * An Expression visitor walks a graph of expressions and turns them into a + * query for the underlying implementation. + * + * @author Benjamin Eberlei + */ +abstract class ExpressionVisitor +{ + /** + * Convert a comparison expression into the target query language output + * + * @param Comparison $comparison + * + * @return mixed + */ + abstract public function walkComparison(Comparison $comparison); + + /** + * Convert a value expression into the target query language part. + * + * @param Value $value + * + * @return mixed + */ + abstract public function walkValue(Value $value); + + /** + * Convert a composite expression into the target query language output + * + * @param CompositeExpression $expr + * + * @return mixed + */ + abstract public function walkCompositeExpression(CompositeExpression $expr); + + /** + * Dispatch walking an expression to the appropriate handler. + * + * @param Expression + * + * @return mixed + */ + public function dispatch(Expression $expr) + { + switch (true) { + case ($expr instanceof Comparison): + return $this->walkComparison($expr); + + case ($expr instanceof Value): + return $this->walkValue($expr); + + case ($expr instanceof CompositeExpression): + return $this->walkCompositeExpression($expr); + + default: + throw new \RuntimeException("Unknown Expression " . get_class($expr)); + } + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php new file mode 100644 index 0000000..f0df11a --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php @@ -0,0 +1,41 @@ +. + */ + +namespace Doctrine\Common\Collections\Expr; + +class Value implements Expression +{ + private $value; + + public function __construct($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } + + public function visit(ExpressionVisitor $visitor) + { + return $visitor->walkValue($this); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php new file mode 100644 index 0000000..b53f0cd --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php @@ -0,0 +1,149 @@ +. + */ + +namespace Doctrine\Common\Collections; + +use Doctrine\Common\Collections\Expr\Comparison; +use Doctrine\Common\Collections\Expr\CompositeExpression; +use Doctrine\Common\Collections\Expr\Value; + +/** + * Builder for Expressions in the {@link Selectable} interface. + * + * @author Benjamin Eberlei + * @since 2.3 + */ +class ExpressionBuilder +{ + /** + * @return CompositeExpression + */ + public function andX($x = null) + { + return new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args()); + } + + /** + * @return CompositeExpression + */ + public function orX($x = null) + { + return new CompositeExpression(CompositeExpression::TYPE_OR, func_get_args()); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function eq($field, $value) + { + return new Comparison($field, Comparison::EQ, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function gt($field, $value) + { + return new Comparison($field, Comparison::GT, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function lt($field, $value) + { + return new Comparison($field, Comparison::LT, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function gte($field, $value) + { + return new Comparison($field, Comparison::GTE, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function lte($field, $value) + { + return new Comparison($field, Comparison::LTE, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function neq($field, $value) + { + return new Comparison($field, Comparison::NEQ, new Value($value)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function isNull($field) + { + return new Comparison($field, Comparison::IS, new Value(null)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function in($field, array $values) + { + return new Comparison($field, Comparison::IN, new Value($values)); + } + + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function notIn($field, array $values) + { + return new Comparison($field, Comparison::NIN, new Value($values)); + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php new file mode 100644 index 0000000..d5543c1 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php @@ -0,0 +1,55 @@ +. + */ + +namespace Doctrine\Common\Collections; + +/** + * Interface for collections that allow efficient filtering with an expression API. + * + * Goal of this interface is a backend independent method to fetch elements + * from a collections. {@link Expression} is crafted in a way that you can + * implement queries from both in-memory and database-backed collections. + * + * For database backed collections this allows very efficient access by + * utilizing the query APIs, for example SQL in the ORM. Applications using + * this API can implement efficient database access without having to ask the + * EntityManager or Repositories. + * + * @author Benjamin Eberlei + * @since 2.3 + */ +interface Selectable +{ + /** + * Select all elements from a selectable that match the expression and + * return a new collection containing these elements. + * + * @param Criteria $criteria + * @return Collection + */ + function matching(Criteria $criteria); + + /** + * Return the expression builder. + * + * @return \Doctrine\Common\Collections\ExpressionBuilder + */ + function expr(); +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php index 8c5669b..6db7675 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -25,4 +25,4 @@ namespace Doctrine\Common; * */ class CommonException extends \Exception { -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php index bc95d30..20d065e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -40,6 +40,8 @@ interface Comparable * This method should not check for identity using ===, only for semantical equality for example * when two different DateTime instances point to the exact same Date + TZ. * + * @param mixed $other + * * @return int */ public function compareTo($other); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php index 6a3c069..a87eee8 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -40,7 +40,6 @@ class EventArgs { /** * @var EventArgs Single instance of EventArgs - * @static */ private static $_emptyEventArgsInstance; @@ -55,7 +54,6 @@ class EventArgs * * @see EventManager::dispatchEvent * @link http://msdn.microsoft.com/en-us/library/system.eventargs.aspx - * @static * @return EventArgs */ public static function getEmptyInstance() diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php b/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php index a1f11ed..25aac44 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -127,10 +127,21 @@ class EventManager * Adds an EventSubscriber. The subscriber is asked for all the events he is * interested in and added as a listener for these events. * - * @param Doctrine\Common\EventSubscriber $subscriber The subscriber. + * @param \Doctrine\Common\EventSubscriber $subscriber The subscriber. */ public function addEventSubscriber(EventSubscriber $subscriber) { $this->addEventListener($subscriber->getSubscribedEvents(), $subscriber); } -} \ No newline at end of file + + /** + * Removes an EventSubscriber. The subscriber is asked for all the events it is + * interested in and removed as a listener for these events. + * + * @param \Doctrine\Common\EventSubscriber $subscriber The subscriber. + */ + public function removeEventSubscriber(EventSubscriber $subscriber) + { + $this->removeEventListener($subscriber->getSubscribedEvents(), $subscriber); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php b/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php index ed3383f..1458791 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php index 8df3b84..8e2554c 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -145,7 +145,7 @@ abstract class Lexer /** * Tells the lexer to skip input tokens until it sees a token with the given value. * - * @param $type The token type to skip until. + * @param string $type The token type to skip until. */ public function skipUntil($type) { @@ -263,4 +263,4 @@ abstract class Lexer * @return integer */ abstract protected function getType(&$value); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php b/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php index 93e504a..e32c0b9 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php index f045286..91882e3 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -34,13 +34,46 @@ use Doctrine\Common\Persistence\ManagerRegistry; */ abstract class AbstractManagerRegistry implements ManagerRegistry { + /** + * @var string + */ private $name; + + /** + * @var array + */ private $connections; + + /** + * @var array + */ private $managers; + + /** + * @var string + */ private $defaultConnection; + + /** + * @var string + */ private $defaultManager; + + /** + * @var string + */ private $proxyInterfaceName; + /** + * Constructor + * + * @param string $name + * @param array $connections + * @param array $managers + * @param string $defaultConnection + * @param string $defaultManager + * @param string $proxyInterfaceName + */ public function __construct($name, array $connections, array $managers, $defaultConnection, $defaultManager, $proxyInterfaceName) { $this->name = $name; @@ -82,7 +115,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getConnection($name = null) { @@ -98,7 +131,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getConnectionNames() { @@ -106,7 +139,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getConnections() { @@ -119,7 +152,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getDefaultConnectionName() { @@ -127,7 +160,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getDefaultManagerName() { @@ -135,7 +168,9 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} + * + * @throws \InvalidArgumentException */ public function getManager($name = null) { @@ -151,7 +186,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getManagerForClass($class) { @@ -170,7 +205,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getManagerNames() { @@ -178,7 +213,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getManagers() { @@ -191,7 +226,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function getRepository($persistentObjectName, $persistentManagerName = null) { @@ -199,7 +234,7 @@ abstract class AbstractManagerRegistry implements ManagerRegistry } /** - * @inheritdoc + * {@inheritdoc} */ public function resetManager($name = null) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php index a47727f..7d6f0cf 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -43,7 +43,7 @@ interface ConnectionRegistry * * @param string $name The connection name (null for the default one) * - * @return Connection + * @return object */ function getConnection($name = null); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php index 8055b66..2fb7c47 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LifecycleEventArgs.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -56,7 +56,7 @@ class LifecycleEventArgs extends EventArgs } /** - * Retireve associated Entity. + * Retrieve associated Entity. * * @return object */ @@ -74,4 +74,4 @@ class LifecycleEventArgs extends EventArgs { return $this->objectManager; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php index 4a18d16..c014d73 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/LoadClassMetadataEventArgs.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -44,7 +44,7 @@ class LoadClassMetadataEventArgs extends EventArgs /** * Constructor. * - * @param ClasseMetadata $classMetadata + * @param ClassMetadata $classMetadata * @param ObjectManager $objectManager */ public function __construct(ClassMetadata $classMetadata, ObjectManager $objectManager) diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php index 33c4d79..f139365 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/ManagerEventArgs.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -56,4 +56,4 @@ class ManagerEventArgs extends \Doctrine\Common\EventArgs { return $this->objectManager; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php index f67ab50..18b6554 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/OnClearEventArgs.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -31,7 +31,7 @@ namespace Doctrine\Common\Persistence\Event; class OnClearEventArgs extends \Doctrine\Common\EventArgs { /** - * @var ObjectManager + * @var \Doctrine\Common\Persistence\ObjectManager */ private $objectManager; @@ -43,7 +43,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs /** * Constructor. * - * @param ObjectManager $objectManager + * @param \Doctrine\Common\Persistence\ObjectManager $objectManager * @param string $entityClass Optional entity class */ public function __construct($objectManager, $entityClass = null) @@ -55,7 +55,7 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs /** * Retrieve associated ObjectManager. * - * @return ObjectManager + * @return \Doctrine\Common\Persistence\ObjectManager */ public function getObjectManager() { @@ -81,4 +81,4 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs { return ($this->entityClass === null); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php index 191d053..86ac819 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Event/PreUpdateEventArgs.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -64,6 +64,8 @@ class PreUpdateEventArgs extends LifecycleEventArgs /** * Check if field has a changeset. * + * @param string $field + * * @return boolean */ public function hasChangedField($field) @@ -114,6 +116,8 @@ class PreUpdateEventArgs extends LifecycleEventArgs * Assert the field exists in changeset. * * @param string $field + * + * @throws \InvalidArgumentException */ private function assertValidField($field) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php index 4d92426..bdb23bd 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -50,7 +50,7 @@ interface ManagerRegistry extends ConnectionRegistry /** * Gets an array of all registered object managers * - * @return array An array of ObjectManager instances + * @return \Doctrine\Common\Persistence\ObjectManager[] An array of ObjectManager instances */ function getManagers(); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php index a2a6185..1ace1cc 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/AbstractClassMetadataFactory.php @@ -13,13 +13,14 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ namespace Doctrine\Common\Persistence\Mapping; -use Doctrine\Common\Cache\Cache; +use Doctrine\Common\Cache\Cache, + Doctrine\Common\Util\ClassUtils; /** * The ClassMetadataFactory is used to create ClassMetadata objects that contain all the @@ -134,7 +135,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory /** * Return the mapping driver implementation. * - * @return MappingDriver + * @return \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver */ abstract protected function getDriver(); @@ -151,54 +152,69 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory * Initialize Reflection after ClassMetadata was constructed. * * @param ClassMetadata $class - * @param ReflectionSErvice $reflService + * @param ReflectionService $reflService * @return void */ abstract protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService); /** + * Checks whether the class metadata is an entity. + * + * This method should false for mapped superclasses or + * embedded classes. + * + * @param ClassMetadata $class + * @return boolean + */ + abstract protected function isEntity(ClassMetadata $class); + + /** * Gets the class metadata descriptor for a class. * * @param string $className The name of the class. - * @return Doctrine\Common\Persistence\Mapping\ClassMetadata + * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata */ public function getMetadataFor($className) { - if ( ! isset($this->loadedMetadata[$className])) { - $realClassName = $className; + if (isset($this->loadedMetadata[$className])) { + return $this->loadedMetadata[$className]; + } - // Check for namespace alias - if (strpos($className, ':') !== false) { - list($namespaceAlias, $simpleClassName) = explode(':', $className); - $realClassName = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); + $realClassName = $className; - if (isset($this->loadedMetadata[$realClassName])) { - // We do not have the alias name in the map, include it - $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; + // Check for namespace alias + if (strpos($className, ':') !== false) { + list($namespaceAlias, $simpleClassName) = explode(':', $className); + $realClassName = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); + } else { + $realClassName = ClassUtils::getRealClass($realClassName); + } - return $this->loadedMetadata[$realClassName]; - } - } + if (isset($this->loadedMetadata[$realClassName])) { + // We do not have the alias name in the map, include it + $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; - if ($this->cacheDriver) { - if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) !== false) { - $this->loadedMetadata[$realClassName] = $cached; - $this->wakeupReflection($cached, $this->getReflectionService()); - } else { - foreach ($this->loadMetadata($realClassName) as $loadedClassName) { - $this->cacheDriver->save( - $loadedClassName . $this->cacheSalt, $this->loadedMetadata[$loadedClassName], null - ); - } - } + return $this->loadedMetadata[$realClassName]; + } + + if ($this->cacheDriver) { + if (($cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt)) !== false) { + $this->loadedMetadata[$realClassName] = $cached; + $this->wakeupReflection($cached, $this->getReflectionService()); } else { - $this->loadMetadata($realClassName); + foreach ($this->loadMetadata($realClassName) as $loadedClassName) { + $this->cacheDriver->save( + $loadedClassName . $this->cacheSalt, $this->loadedMetadata[$loadedClassName], null + ); + } } + } else { + $this->loadMetadata($realClassName); + } - if ($className != $realClassName) { - // We do not have the alias name in the map, include it - $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; - } + if ($className != $realClassName) { + // We do not have the alias name in the map, include it + $this->loadedMetadata[$className] = $this->loadedMetadata[$realClassName]; } return $this->loadedMetadata[$className]; @@ -251,7 +267,8 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory * is still not loaded. * * @param string $name The name of the class for which the metadata should get loaded. - * @param array $tables The metadata collection to which the loaded metadata is added. + * + * @return array */ protected function loadMetadata($name) { @@ -272,7 +289,7 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory foreach ($parentClasses as $className) { if (isset($this->loadedMetadata[$className])) { $parent = $this->loadedMetadata[$className]; - if (isset($parent->isMappedSuperclass) && $parent->isMappedSuperclass === false) { + if ($this->isEntity($parent)) { $rootEntityFound = true; array_unshift($visited, $className); } @@ -282,13 +299,13 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory $class = $this->newClassMetadataInstance($className); $this->initializeReflection($class, $reflService); - $this->doLoadMetadata($class, $parent, $rootEntityFound); + $this->doLoadMetadata($class, $parent, $rootEntityFound, $visited); $this->loadedMetadata[$className] = $class; $parent = $class; - if (isset($parent->isMappedSuperclass) && $class->isMappedSuperclass === false) { + if ($this->isEntity($class)) { $rootEntityFound = true; array_unshift($visited, $className); } @@ -305,11 +322,12 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory * Actually load the metadata from the underlying metadata * * @param ClassMetadata $class - * @param ClassMetadata $parent + * @param ClassMetadata|null $parent * @param bool $rootEntityFound + * @param array $nonSuperclassParents classnames all parent classes that are not marked as mapped superclasses * @return void */ - abstract protected function doLoadMetadata($class, $parent, $rootEntityFound); + abstract protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents); /** * Creates a new ClassMetadata instance for the given class name. @@ -331,6 +349,12 @@ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory $this->initialize(); } + // Check for namespace alias + if (strpos($class, ':') !== false) { + list($namespaceAlias, $simpleClassName) = explode(':', $class); + $class = $this->getFqcnFromAlias($namespaceAlias, $simpleClassName); + } + return $this->getDriver()->isTransient($class); } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php index 705d59a..4836bf8 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadata.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -49,7 +49,7 @@ interface ClassMetadata /** * Gets the ReflectionClass instance for this mapped class. * - * @return ReflectionClass + * @return \ReflectionClass */ function getReflectionClass(); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php index bf27ba9..3fa39bc 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ClassMetadataFactory.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php index f52d37e..1131add 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -118,7 +118,7 @@ abstract class AnnotationDriver implements MappingDriver /** * Get the file extension used to look for mapping files under * - * @return void + * @return string */ public function getFileExtension() { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php index efaf545..0d61174 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/DefaultFileLocator.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -51,6 +51,7 @@ class DefaultFileLocator implements FileLocator * documents and operates in the specified operating mode. * * @param string|array $paths One or multiple paths where mapping documents can be found. + * @param string|null $fileExtension */ public function __construct($paths, $fileExtension = null) { @@ -81,7 +82,7 @@ class DefaultFileLocator implements FileLocator /** * Get the file extension used to look for mapping files under * - * @return void + * @return string */ public function getFileExtension() { @@ -166,4 +167,4 @@ class DefaultFileLocator implements FileLocator return false; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php index 22cf117..b0a7685 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileDriver.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -58,7 +58,7 @@ abstract class FileDriver implements MappingDriver * Initializes a new FileDriver that looks in the given path(s) for mapping * documents and operates in the specified operating mode. * - * @param string|array|FileLocator $paths A FileLocator or one/multiple paths where mapping documents can be found. + * @param string|array|FileLocator $locator A FileLocator or one/multiple paths where mapping documents can be found. * @param string $fileExtension */ public function __construct($locator, $fileExtension = null) @@ -70,11 +70,21 @@ abstract class FileDriver implements MappingDriver } } + /** + * Set global basename + * + * @param string $file + */ public function setGlobalBasename($file) { $this->globalBasename = $file; } + /** + * Retrieve global basename + * + * @return string + */ public function getGlobalBasename() { return $this->globalBasename; @@ -84,7 +94,10 @@ abstract class FileDriver implements MappingDriver * Get the element of schema meta data for the class from the mapping file. * This will lazily load the mapping file if it is not loaded yet * - * @return array $element The element of schema meta data + * @param string $className + * + * @throws MappingException + * @return array The element of schema meta data */ public function getElement($className) { @@ -97,6 +110,9 @@ abstract class FileDriver implements MappingDriver } $result = $this->loadMappingFile($this->locator->findMappingFile($className)); + if (!isset($result[$className])) { + throw MappingException::invalidMappingFile($className, str_replace('\\', '.', $className) . $this->locator->getFileExtension()); + } return $result[$className]; } @@ -175,4 +191,24 @@ abstract class FileDriver implements MappingDriver } } } -} \ No newline at end of file + + /** + * Retrieve the locator used to discover mapping files by className + * + * @return FileLocator + */ + public function getLocator() + { + return $this->locator; + } + + /** + * Set the locator used to discover mapping files by className + * + * @param FileLocator $locator + */ + public function setLocator(FileLocator $locator) + { + $this->locator = $locator; + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php index a1019d7..ec2b606 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/FileLocator.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -22,7 +22,7 @@ namespace Doctrine\Common\Persistence\Mapping\Driver; /** * Locate the file that contains the metadata information for a given class name. * - * This behavior is inpependent of the actual content of the file. It just detects + * This behavior is independent of the actual content of the file. It just detects * the file which is responsible for the given class name. * * @author Benjamin Eberlei @@ -49,6 +49,8 @@ interface FileLocator /** * Check if a file can be found for this class name. * + * @param string $className + * * @return bool */ function fileExists($className); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php index c050d32..955d831 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriver.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -53,4 +53,4 @@ interface MappingDriver * @return boolean */ function isTransient($className); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php index c7c1452..3b1049d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -36,14 +36,41 @@ use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver, class MappingDriverChain implements MappingDriver { /** + * The default driver + * + * @var MappingDriver + */ + private $defaultDriver; + + /** * @var array */ private $drivers = array(); /** + * Get the default driver. + * + * @return MappingDriver|null + */ + public function getDefaultDriver() + { + return $this->defaultDriver; + } + + /** + * Set the default driver. + * + * @param MappingDriver $driver + */ + public function setDefaultDriver(MappingDriver $driver) + { + $this->defaultDriver = $driver; + } + + /** * Add a nested driver. * - * @param Driver $nestedDriver + * @param MappingDriver $nestedDriver * @param string $namespace */ public function addDriver(MappingDriver $nestedDriver, $namespace) @@ -65,10 +92,13 @@ class MappingDriverChain implements MappingDriver * Loads the metadata for the specified class into the provided container. * * @param string $className - * @param ClassMetadataInfo $metadata + * @param ClassMetadata $metadata + * + * @throws MappingException */ public function loadMetadataForClass($className, ClassMetadata $metadata) { + /* @var $driver MappingDriver */ foreach ($this->drivers as $namespace => $driver) { if (strpos($className, $namespace) === 0) { $driver->loadMetadataForClass($className, $metadata); @@ -76,6 +106,11 @@ class MappingDriverChain implements MappingDriver } } + if (null !== $this->defaultDriver) { + $this->defaultDriver->loadMetadataForClass($className, $metadata); + return; + } + throw MappingException::classNotFoundInNamespaces($className, array_keys($this->drivers)); } @@ -88,8 +123,11 @@ class MappingDriverChain implements MappingDriver { $classNames = array(); $driverClasses = array(); + + /* @var $driver MappingDriver */ foreach ($this->drivers AS $namespace => $driver) { $oid = spl_object_hash($driver); + if (!isset($driverClasses[$oid])) { $driverClasses[$oid] = $driver->getAllClassNames(); } @@ -100,6 +138,7 @@ class MappingDriverChain implements MappingDriver } } } + return array_keys($classNames); } @@ -113,13 +152,17 @@ class MappingDriverChain implements MappingDriver */ public function isTransient($className) { + /* @var $driver MappingDriver */ foreach ($this->drivers AS $namespace => $driver) { if (strpos($className, $namespace) === 0) { return $driver->isTransient($className); } } - // class isTransient, i.e. not an entity or mapped superclass + if ($this->defaultDriver !== null) { + return $this->defaultDriver->isTransient($className); + } + return true; } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php index 7751dae..e0c8611 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/PHPDriver.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -66,5 +66,7 @@ class PHPDriver extends FileDriver { $metadata = $this->metadata; include $file; + + return array($metadata->getName() => $metadata); } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php index 9103ed8..e3cea73 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/StaticPHPDriver.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -50,11 +50,21 @@ class StaticPHPDriver implements MappingDriver */ private $classNames; + /** + * Constructor + * + * @param array|string $paths + */ public function __construct($paths) { $this->addPaths((array) $paths); } + /** + * Add paths + * + * @param array $paths + */ public function addPaths(array $paths) { $this->paths = array_unique(array_merge($this->paths, $paths)); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php index d338cf6..9095187 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/SymfonyFileLocator.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -53,18 +53,34 @@ class SymfonyFileLocator implements FileLocator */ protected $fileExtension; + /** + * Constructor + * + * @param array $prefixes + * @param string|null $fileExtension + */ public function __construct(array $prefixes, $fileExtension = null) { $this->addNamespacePrefixes($prefixes); $this->fileExtension = $fileExtension; } + /** + * Add Namespace Prefixes + * + * @param array $prefixes + */ public function addNamespacePrefixes(array $prefixes) { $this->prefixes = array_merge($this->prefixes, $prefixes); $this->paths = array_merge($this->paths, array_keys($prefixes)); } + /** + * Get Namespace Prefixes + * + * @return array + */ public function getNamespacePrefixes() { return $this->prefixes; diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php index 4ecd2ad..c1e7ad5 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -26,18 +26,32 @@ namespace Doctrine\Common\Persistence\Mapping; */ class MappingException extends \Exception { + /** + * + * @param string $className + * @param array $namespaces + * + * @return MappingException + */ public static function classNotFoundInNamespaces($className, $namespaces) { return new self("The class '" . $className . "' was not found in the ". "chain configured namespaces " . implode(", ", $namespaces)); } + /** + * @return MappingException + */ public static function pathRequired() { return new self("Specifying the paths to your entities is required ". "in the AnnotationDriver to retrieve all class names."); } + /** + * @param string|null $path + * @return MappingException + */ public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) { if ( ! empty($path)) { @@ -50,8 +64,23 @@ class MappingException extends \Exception ); } + /** + * @param string $entityName + * @param string $fileName + * @return MappingException + */ public static function mappingFileNotFound($entityName, $fileName) { return new self("No mapping file found named '$fileName' for class '$entityName'."); } + + /** + * @param string $entityName + * @param string $fileName + * @return MappingException + */ + public static function invalidMappingFile($entityName, $fileName) + { + return new self("Invalid mapping file '$fileName' for class '$entityName'."); + } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php index 4e0e312..3db85d9 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/ReflectionService.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -55,7 +55,7 @@ interface ReflectionService * Return a reflection class instance or null * * @param string $class - * @return ReflectionClass|null + * @return \ReflectionClass|null */ function getClass($class); @@ -64,7 +64,7 @@ interface ReflectionService * * @param string $class * @param string $property - * @return ReflectionProperty|null + * @return \ReflectionProperty|null */ function getAccessibleProperty($class, $property); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php index abcff58..77b9e76 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php index 2de6e76..4f6d1cf 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/StaticReflectionService.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php index 6d70fc1..2bb8722 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -68,10 +68,19 @@ interface ObjectManager * The object passed to merge will not become associated/managed with this ObjectManager. * * @param object $object + * @return object */ function merge($object); /** + * Clears the ObjectManager. All objects that are currently managed + * by this ObjectManager become detached. + * + * @param string $objectName if given, only objects of this type will get detached + */ + function clear($objectName = null); + + /** * Detaches an object from the ObjectManager, causing a managed object to * become detached. Unflushed changes made to the object if any * (including removal of the object), will not be synchronized to the database. @@ -119,7 +128,7 @@ interface ObjectManager /** * Gets the metadata factory used to gather the metadata of classes. * - * @return Doctrine\Common\Persistence\Mapping\ClassMetadataFactory + * @return \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory */ function getMetadataFactory(); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php index 015dd3d..69fba78 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php index 2263328..9a3e5b6 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -33,7 +33,7 @@ interface ObjectRepository /** * Finds an object by its primary key / identifier. * - * @param $id The identifier. + * @param int $id The identifier. * @return object The object. */ function find($id); @@ -52,7 +52,7 @@ interface ObjectRepository * an UnexpectedValueException if certain values of the sorting or limiting details are * not supported. * - * @throws UnexpectedValueException + * @throws \UnexpectedValueException * @param array $criteria * @param array|null $orderBy * @param int|null $limit diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php index 4274af6..9fcc4cb 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -90,6 +90,8 @@ abstract class PersistentObject implements ObjectManagerAware * * @param ObjectManager $objectManager * @param ClassMetadata $classMetadata + * + * @throws \RuntimeException */ public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) { @@ -104,10 +106,11 @@ abstract class PersistentObject implements ObjectManagerAware /** * Sets a persistent fields value. * - * @throws InvalidArgumentException - When the wrong target object type is passed to an association - * @throws BadMethodCallException - When no persistent field exists by that name. * @param string $field * @param array $args + * + * @throws \BadMethodCallException - When no persistent field exists by that name. + * @throws \InvalidArgumentException - When the wrong target object type is passed to an association * @return void */ private function set($field, $args) @@ -131,8 +134,10 @@ abstract class PersistentObject implements ObjectManagerAware /** * Get persistent field value. * - * @throws BadMethodCallException - When no persistent field exists by that name. + * * @param string $field + * + * @throws \BadMethodCallException - When no persistent field exists by that name. * @return mixed */ private function get($field) @@ -169,8 +174,11 @@ abstract class PersistentObject implements ObjectManagerAware /** * Add an object to a collection * - * @param type $field - * @param assoc $args + * @param string $field + * @param array $args + * + * @throws \BadMethodCallException + * @throws \InvalidArgumentException */ private function add($field, $args) { @@ -194,6 +202,7 @@ abstract class PersistentObject implements ObjectManagerAware /** * Initialize Doctrine Metadata for this class. * + * @throws \RuntimeException * @return void */ private function initializeDoctrine() @@ -214,6 +223,8 @@ abstract class PersistentObject implements ObjectManagerAware * * @param string $method * @param array $args + * + * @throws \BadMethodCallException * @return mixed */ public function __call($method, $args) diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php index 726979f..e25598c 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php @@ -14,7 +14,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php b/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php index 87c5b41..1171874 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php new file mode 100644 index 0000000..ae69607 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php @@ -0,0 +1,38 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +/** + * Finds a class in a PSR-0 structure. + * + * @author Karoly Negyesi + */ +interface ClassFinderInterface +{ + /** + * Finds a class. + * + * @param string $class The name of the class. + * + * @return + * The name of the class or NULL if not found. + */ + public function findFile($class); +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php new file mode 100644 index 0000000..b6a5fd1 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php @@ -0,0 +1,83 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +/** + * Finds a class in a PSR-0 structure. + * + * @author Karoly Negyesi + */ +class Psr0FindFile implements ClassFinderInterface +{ + /** + * The PSR-0 prefixes. + * + * @var string + */ + protected $prefixes; + + /** + * @param string $prefixes + * An array of prefixes. Each key is a PHP namespace and each value is + * a list of directories. + */ + public function __construct($prefixes) + { + $this->prefixes = $prefixes; + } + + /** + * Finds a class. + * + * @param string $class The name of the class. + * + * @return + * The name of the class or NULL if not found. + */ + public function findFile($class) + { + $lastNsPos = strrpos($class, '\\'); + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + if (false !== $lastNsPos) { + // namespaced class name + $classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $lastNsPos)) . DIRECTORY_SEPARATOR; + $className = substr($class, $lastNsPos + 1); + } else { + // PEAR-like class name + $classPath = null; + $className = $class; + } + + $classPath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + + foreach ($this->prefixes as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { + return $dir . DIRECTORY_SEPARATOR . $classPath; + } + } + } + } + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php new file mode 100644 index 0000000..a436a2d --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php @@ -0,0 +1,45 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +interface ReflectionProviderInterface +{ + /** + * Get the ReflectionClass equivalent for this class. + * + * @return ReflectionClass + */ + public function getReflectionClass(); + + /** + * Get the ReflectionClass equivalent for this class. + * + * @return ReflectionMethod + */ + public function getReflectionMethod($name); + + /** + * Get the ReflectionClass equivalent for this class. + * + * @return ReflectionMethod + */ + public function getReflectionProperty($name); +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php new file mode 100644 index 0000000..12e45d5 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php @@ -0,0 +1,112 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionClass; +use ReflectionException; + +class StaticReflectionClass extends ReflectionClass +{ + /** + * The static reflection parser object. + * + * @var StaticReflectionParser + */ + private $staticReflectionParser; + + public function __construct(StaticReflectionParser $staticReflectionParser) + { + $this->staticReflectionParser = $staticReflectionParser; + } + + public function getName() + { + return $this->staticReflectionParser->getClassName(); + } + + public function getDocComment() + { + return $this->staticReflectionParser->getDocComment(); + } + + public function getNamespaceName() + { + return $this->staticReflectionParser->getNamespaceName(); + } + + public function getUseStatements() + { + return $this->staticReflectionParser->getUseStatements(); + } + + public function getMethod($name) + { + return $this->staticReflectionParser->getReflectionMethod($name); + } + + public function getProperty($name) + { + return $this->staticReflectionParser->getReflectionProperty($name); + } + + public static function export($argument, $return = false) { throw new ReflectionException('Method not implemented'); } + public function getConstant($name) { throw new ReflectionException('Method not implemented'); } + public function getConstants() { throw new ReflectionException('Method not implemented'); } + public function getConstructor() { throw new ReflectionException('Method not implemented'); } + public function getDefaultProperties() { throw new ReflectionException('Method not implemented'); } + public function getEndLine() { throw new ReflectionException('Method not implemented'); } + public function getExtension() { throw new ReflectionException('Method not implemented'); } + public function getExtensionName() { throw new ReflectionException('Method not implemented'); } + public function getFileName() { throw new ReflectionException('Method not implemented'); } + public function getInterfaceNames() { throw new ReflectionException('Method not implemented'); } + public function getInterfaces() { throw new ReflectionException('Method not implemented'); } + public function getMethods($filter = NULL) { throw new ReflectionException('Method not implemented'); } + public function getModifiers() { throw new ReflectionException('Method not implemented'); } + public function getParentClass() { throw new ReflectionException('Method not implemented'); } + public function getProperties($filter = NULL) { throw new ReflectionException('Method not implemented'); } + public function getShortName() { throw new ReflectionException('Method not implemented'); } + public function getStartLine() { throw new ReflectionException('Method not implemented'); } + public function getStaticProperties() { throw new ReflectionException('Method not implemented'); } + public function getStaticPropertyValue($name, $default = '') { throw new ReflectionException('Method not implemented'); } + public function getTraitAliases() { throw new ReflectionException('Method not implemented'); } + public function getTraitNames() { throw new ReflectionException('Method not implemented'); } + public function getTraits() { throw new ReflectionException('Method not implemented'); } + public function hasConstant($name) { throw new ReflectionException('Method not implemented'); } + public function hasMethod($name) { throw new ReflectionException('Method not implemented'); } + public function hasProperty($name) { throw new ReflectionException('Method not implemented'); } + public function implementsInterface($interface) { throw new ReflectionException('Method not implemented'); } + public function inNamespace() { throw new ReflectionException('Method not implemented'); } + public function isAbstract() { throw new ReflectionException('Method not implemented'); } + public function isCloneable() { throw new ReflectionException('Method not implemented'); } + public function isFinal() { throw new ReflectionException('Method not implemented'); } + public function isInstance($object) { throw new ReflectionException('Method not implemented'); } + public function isInstantiable() { throw new ReflectionException('Method not implemented'); } + public function isInterface() { throw new ReflectionException('Method not implemented'); } + public function isInternal() { throw new ReflectionException('Method not implemented'); } + public function isIterateable() { throw new ReflectionException('Method not implemented'); } + public function isSubclassOf($class) { throw new ReflectionException('Method not implemented'); } + public function isTrait() { throw new ReflectionException('Method not implemented'); } + public function isUserDefined() { throw new ReflectionException('Method not implemented'); } + public function newInstance($args) { throw new ReflectionException('Method not implemented'); } + public function newInstanceArgs(array $args = array()) { throw new ReflectionException('Method not implemented'); } + public function newInstanceWithoutConstructor() { throw new ReflectionException('Method not implemented'); } + public function setStaticPropertyValue($name, $value) { throw new ReflectionException('Method not implemented'); } + public function __toString() { throw new ReflectionException('Method not implemented'); } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php new file mode 100644 index 0000000..6482036 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php @@ -0,0 +1,103 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionMethod; +use ReflectionException; + +class StaticReflectionMethod extends ReflectionMethod +{ + /** + * The PSR-0 parser object. + * + * @var StaticReflectionParser + */ + protected $staticReflectionParser; + + /** + * The name of the method. + * + * @var string + */ + protected $methodName; + + public function __construct(StaticReflectionParser $staticReflectionParser, $methodName) + { + $this->staticReflectionParser = $staticReflectionParser; + $this->methodName = $methodName; + } + public function getName() + { + return $this->methodName; + } + protected function getStaticReflectionParser() + { + return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('method', $this->methodName); + } + public function getDeclaringClass() + { + return $this->getStaticReflectionParser()->getReflectionClass(); + } + public function getNamespaceName() + { + return $this->getStaticReflectionParser()->getNamespaceName(); + } + public function getDocComment() + { + return $this->getStaticReflectionParser()->getDocComment('method', $this->methodName); + } + public function getUseStatements() + { + return $this->getStaticReflectionParser()->getUseStatements(); + } + public static function export($class, $name, $return = false) { throw new ReflectionException('Method not implemented'); } + public function getClosure($object) { throw new ReflectionException('Method not implemented'); } + public function getModifiers() { throw new ReflectionException('Method not implemented'); } + public function getPrototype() { throw new ReflectionException('Method not implemented'); } + public function invoke($object, $parameter = NULL) { throw new ReflectionException('Method not implemented'); } + public function invokeArgs($object, array $args) { throw new ReflectionException('Method not implemented'); } + public function isAbstract() { throw new ReflectionException('Method not implemented'); } + public function isConstructor() { throw new ReflectionException('Method not implemented'); } + public function isDestructor() { throw new ReflectionException('Method not implemented'); } + public function isFinal() { throw new ReflectionException('Method not implemented'); } + public function isPrivate() { throw new ReflectionException('Method not implemented'); } + public function isProtected() { throw new ReflectionException('Method not implemented'); } + public function isPublic() { throw new ReflectionException('Method not implemented'); } + public function isStatic() { throw new ReflectionException('Method not implemented'); } + public function setAccessible($accessible) { throw new ReflectionException('Method not implemented'); } + public function __toString() { throw new ReflectionException('Method not implemented'); } + public function getClosureThis() { throw new ReflectionException('Method not implemented'); } + public function getEndLine() { throw new ReflectionException('Method not implemented'); } + public function getExtension() { throw new ReflectionException('Method not implemented'); } + public function getExtensionName() { throw new ReflectionException('Method not implemented'); } + public function getFileName() { throw new ReflectionException('Method not implemented'); } + public function getNumberOfParameters() { throw new ReflectionException('Method not implemented'); } + public function getNumberOfRequiredParameters() { throw new ReflectionException('Method not implemented'); } + public function getParameters() { throw new ReflectionException('Method not implemented'); } + public function getShortName() { throw new ReflectionException('Method not implemented'); } + public function getStartLine() { throw new ReflectionException('Method not implemented'); } + public function getStaticVariables() { throw new ReflectionException('Method not implemented'); } + public function inNamespace() { throw new ReflectionException('Method not implemented'); } + public function isClosure() { throw new ReflectionException('Method not implemented'); } + public function isDeprecated() { throw new ReflectionException('Method not implemented'); } + public function isInternal() { throw new ReflectionException('Method not implemented'); } + public function isUserDefined() { throw new ReflectionException('Method not implemented'); } + public function returnsReference() { throw new ReflectionException('Method not implemented'); } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php new file mode 100644 index 0000000..7f3e41f --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php @@ -0,0 +1,282 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionException; +use Doctrine\Common\Annotations\TokenParser; + +/** + * Parses a file for namespaces/use/class declarations. + * + * @author Karoly Negyesi + */ +class StaticReflectionParser implements ReflectionProviderInterface +{ + + /** + * The name of the class. + * + * @var string + */ + protected $className; + + /** + * TRUE if the caller only wants class annotations. + * + * @var boolean. + */ + protected $classAnnotationOptimize; + + /** + * TRUE when the parser has ran. + * + * @var boolean + */ + protected $parsed = false; + + /** + * The namespace of the class + * + * @var string + */ + protected $namespace = ''; + + /** + * The use statements of this class. + * + * @var array + */ + protected $useStatements = array(); + + /** + * The docComment of the class. + * + * @var string + */ + protected $docComment = array( + 'class' => '', + 'property' => array(), + 'method' => array(), + ); + + /** + * The name of the class this class extends, if any. + * + * @var string + */ + protected $parentClassName = ''; + + /** + * The parent PSR-0 Parser. + * + * @var \Doctrine\Common\Annotations\StaticReflectionParser + */ + protected $parentStaticReflectionParser; + + /** + * Parses a class residing in a PSR-0 hierarchy. + * + * @param string $class + * The full, namespaced class name. + * @param ClassFinder $finder + * A ClassFinder object which finds the class. + * @param boolean $classAnnotationOptimize + * Only retrieve the class docComment. Presumes there is only one + * statement per line. + */ + public function __construct($className, $finder, $classAnnotationOptimize = false) + { + $this->className = ltrim($className, '\\'); + if ($lastNsPos = strrpos($this->className, '\\')) { + $this->namespace = substr($this->className, 0, $lastNsPos); + } + $this->finder = $finder; + $this->classAnnotationOptimize = $classAnnotationOptimize; + } + + protected function parse() + { + if ($this->parsed || !$fileName = $this->finder->findFile($this->className)) { + return; + } + $this->parsed = true; + $contents = file_get_contents($fileName); + if ($this->classAnnotationOptimize) { + if (preg_match("/(\A.*)^\s+(abstract|final)?\s+class\s+$className\s+{/sm", $contents, $matches)) { + $contents = $matches[1]; + } + } + $tokenParser = new TokenParser($contents); + $docComment = ''; + while ($token = $tokenParser->next(false)) { + if (is_array($token)) { + switch ($token[0]) { + case T_USE: + $this->useStatements = array_merge($this->useStatements, $tokenParser->parseUseStatement()); + break; + case T_DOC_COMMENT: + $docComment = $token[1]; + break; + case T_CLASS: + $this->docComment['class'] = $docComment; + $docComment = ''; + break; + case T_VAR: + case T_PRIVATE: + case T_PROTECTED: + case T_PUBLIC: + $token = $tokenParser->next(); + if ($token[0] === T_VARIABLE) { + $propertyName = substr($token[1], 1); + $this->docComment['property'][$propertyName] = $docComment; + continue 2; + } + if ($token[0] !== T_FUNCTION) { + // For example, it can be T_FINAL. + continue 2; + } + // No break. + case T_FUNCTION: + // The next string after function is the name, but + // there can be & before the function name so find the + // string. + while (($token = $tokenParser->next()) && $token[0] !== T_STRING); + $methodName = $token[1]; + $this->docComment['method'][$methodName] = $docComment; + $docComment = ''; + break; + case T_EXTENDS: + $this->parentClassName = $tokenParser->parseClass(); + $nsPos = strpos($this->parentClassName, '\\'); + $fullySpecified = false; + if ($nsPos === 0) { + $fullySpecified = true; + } else { + if ($nsPos) { + $prefix = strtolower(substr($this->parentClassName, 0, $nsPos)); + $postfix = substr($this->parentClassName, $nsPos); + } else { + $prefix = strtolower($this->parentClassName); + $postfix = ''; + } + foreach ($this->useStatements as $alias => $use) { + if ($alias == $prefix) { + $this->parentClassName = '\\' . $use . $postfix; + $fullySpecified = true; + } + } + } + if (!$fullySpecified) { + $this->parentClassName = '\\' . $this->namespace . '\\' . $this->parentClassName; + } + break; + } + } + } + } + + protected function getParentStaticReflectionParser() + { + if (empty($this->parentStaticReflectionParser)) { + $this->parentStaticReflectionParser = new static($this->parentClassName, $this->finder); + } + + return $this->parentStaticReflectionParser; + } + + public function getClassName() + { + return $this->className; + } + + public function getNamespaceName() + { + return $this->namespace; + } + + /** + * Get the ReflectionClass equivalent for this file / class. + */ + public function getReflectionClass() + { + return new StaticReflectionClass($this); + } + + /** + * Get the ReflectionMethod equivalent for the method of this file / class. + */ + public function getReflectionMethod($methodName) + { + return new StaticReflectionMethod($this, $methodName); + } + + /** + * Get the ReflectionProperty equivalent for the method of this file / class. + */ + public function getReflectionProperty($propertyName) + { + return new StaticReflectionProperty($this, $propertyName); + } + + /** + * Get the use statements from this file. + */ + public function getUseStatements() + { + $this->parse(); + + return $this->useStatements; + } + + /** + * Get docComment. + * + * @param string $type class, property or method. + * @param string $name Name of the property or method, not needed for class. + * + * @return string the doc comment or empty string if none. + */ + public function getDocComment($type = 'class', $name = '') + { + $this->parse(); + + return $name ? $this->docComment[$type][$name] : $this->docComment[$type]; + } + + /** + * Get the PSR-0 parser for the declaring class. + * + * @param string $type property or method. + * @param string $name Name of the property or method. + * + * @return StaticReflectionParser A static reflection parser for the declaring class. + */ + public function getStaticReflectionParserForDeclaringClass($type, $name) + { + $this->parse(); + if (isset($this->docComment[$type][$name])) { + return $this; + } + if (!empty($this->parentClassName)) { + return $this->getParentStaticReflectionParser()->getStaticReflectionParserForDeclaringClass($type, $name); + } + throw new ReflectionException('Invalid ' . $type . ' "' . $name . '"'); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php new file mode 100644 index 0000000..7c6411a --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php @@ -0,0 +1,77 @@ +. + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionProperty; +use ReflectionException; + +class StaticReflectionProperty extends ReflectionProperty +{ + /** + * The PSR-0 parser object. + * + * @var StaticReflectionParser + */ + protected $staticReflectionParser; + + /** + * The name of the property. + * + * @var string + */ + protected $propertyName; + + public function __construct(StaticReflectionParser $staticReflectionParser, $propertyName) + { + $this->staticReflectionParser = $staticReflectionParser; + $this->propertyName = $propertyName; + } + public function getName() + { + return $this->propertyName; + } + protected function getStaticReflectionParser() + { + return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', $this->propertyName); + } + public function getDeclaringClass() + { + return $this->getStaticReflectionParser()->getReflectionClass(); + } + public function getDocComment() + { + return $this->getStaticReflectionParser()->getDocComment('property', $this->propertyName); + } + public function getUseStatements() + { + return $this->getStaticReflectionParser()->getUseStatements(); + } + public static function export ($class, $name, $return = false) { throw new ReflectionException('Method not implemented'); } + public function getModifiers() { throw new ReflectionException('Method not implemented'); } + public function getValue($object = NULL) { throw new ReflectionException('Method not implemented'); } + public function isDefault() { throw new ReflectionException('Method not implemented'); } + public function isPrivate() { throw new ReflectionException('Method not implemented'); } + public function isProtected() { throw new ReflectionException('Method not implemented'); } + public function isPublic() { throw new ReflectionException('Method not implemented'); } + public function isStatic() { throw new ReflectionException('Method not implemented'); } + public function setAccessible ($accessible) { throw new ReflectionException('Method not implemented'); } + public function setValue ($object, $value = NULL) { throw new ReflectionException('Method not implemented'); } + public function __toString() { throw new ReflectionException('Method not implemented'); } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php index c346278..078a8db 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -71,7 +71,7 @@ class ClassUtils * Create a new reflection class * * @param string - * @return ReflectionClass + * @return \ReflectionClass */ public static function newReflectionClass($class) { @@ -82,7 +82,7 @@ class ClassUtils * Create a new reflection object * * @param object - * @return ReflectionObject + * @return \ReflectionObject */ public static function newReflectionObject($object) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php index 57ae312..458e5c8 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -41,7 +41,6 @@ final class Debug /** * Prints a dump of the public, protected and private properties of $var. * - * @static * @link http://xdebug.org/ * @param mixed $var * @param integer $maxDepth Maximum nesting level for object properties @@ -67,6 +66,13 @@ final class Debug ini_set('html_errors', 'Off'); } + /** + * Export + * + * @param mixed $var + * @param int $maxDepth + * @return mixed + */ public static function export($var, $maxDepth) { $return = null; @@ -116,6 +122,12 @@ final class Debug return $return; } + /** + * Convert to string + * + * @param object $obj + * @return string + */ public static function toString($obj) { return method_exists('__toString', $obj) ? (string) $obj : get_class($obj) . '@' . spl_object_hash($obj); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php index ba1eb17..214ed57 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php @@ -15,7 +15,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -69,4 +69,4 @@ class Inflector { return lcfirst(self::classify($word)); } -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php index b7c9a82..5cad4c6 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php @@ -13,7 +13,7 @@ * 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 LGPL. For more information, see + * and is licensed under the MIT license. For more information, see * . */ @@ -36,7 +36,7 @@ class Version /** * Current Doctrine Version */ - const VERSION = '2.2.2'; + const VERSION = '2.3.0-BETA1'; /** * Compares a Doctrine version with the current one. diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php index 0a329a3..4261e6b 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php @@ -3,6 +3,8 @@ namespace Doctrine\Tests\Common\Annotations; use Doctrine\Common\Annotations\DoctrineReader; +use Doctrine\Common\Reflection\StaticReflectionParser; +use Doctrine\Common\Reflection\Psr0FindFile; use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation; use Doctrine\Common\Annotations\Annotation\IgnorePhpDoc; use ReflectionClass, Doctrine\Common\Annotations\AnnotationReader; @@ -19,11 +21,26 @@ require_once __DIR__ . '/TopLevelAnnotation.php'; abstract class AbstractReaderTest extends \PHPUnit_Framework_TestCase { - public function testAnnotations() + public function getReflectionClass() { - $reader = $this->getReader(); + $className = 'Doctrine\Tests\Common\Annotations\DummyClass'; + $testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1); + $paths = array( + 'Doctrine\\Tests' => array($testsRoot), + ); + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + return array( + 'native' => array(new ReflectionClass($className)), + 'static' => array($staticReflectionParser->getReflectionClass()), + ); + } - $class = new ReflectionClass('Doctrine\Tests\Common\Annotations\DummyClass'); + /** + * @dataProvider getReflectionClass + */ + public function testAnnotations($class) + { + $reader = $this->getReader(); $this->assertEquals(1, count($reader->getClassAnnotations($class))); $this->assertInstanceOf($annotName = 'Doctrine\Tests\Common\Annotations\DummyAnnotation', $annot = $reader->getClassAnnotation($class, $annotName)); $this->assertEquals("hello", $annot->dummyValue); @@ -399,44 +416,6 @@ class TestImportWithConcreteAnnotation } /** - * A description of this class. - * - * Let's see if the parser recognizes that this @ is not really referring to an - * annotation. Also make sure that @var \ is not concated to "@var\is". - * - * @author robo - * @since 2.0 - * @DummyAnnotation(dummyValue="hello") - */ -class DummyClass { - /** - * A nice property. - * - * @var mixed - * @DummyAnnotation(dummyValue="fieldHello") - */ - private $field1; - - /** - * @DummyJoinTable(name="join_table", - * joinColumns={@DummyJoinColumn(name="col1", referencedColumnName="col2")}, - * inverseJoinColumns={ - * @DummyJoinColumn(name="col3", referencedColumnName="col4") - * }) - */ - private $field2; - - /** - * Gets the value of field1. - * - * @return mixed - * @DummyAnnotation({1,2,"three"}) - */ - public function getField1() { - } -} - -/** * @ignoreAnnotation("var") */ class DummyClass2 { diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php index cb080f0..03a55c8 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php @@ -24,4 +24,114 @@ class DocLexerTest extends \PHPUnit_Framework_TestCase $this->assertFalse($lexer->moveNext()); } + + public function testScannerTokenizesDocBlockWhitConstants() + { + $lexer = new DocLexer(); + $docblock = '@AnnotationWithConstants(PHP_EOL, ClassWithConstants::SOME_VALUE, \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)'; + + $tokens = array ( + array( + 'value' => '@', + 'position' => 0, + 'type' => DocLexer::T_AT, + ), + array( + 'value' => 'AnnotationWithConstants', + 'position' => 1, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => '(', + 'position' => 24, + 'type' => DocLexer::T_OPEN_PARENTHESIS, + ), + array( + 'value' => 'PHP_EOL', + 'position' => 25, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => ',', + 'position' => 32, + 'type' => DocLexer::T_COMMA, + ), + array( + 'value' => 'ClassWithConstants::SOME_VALUE', + 'position' => 34, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => ',', + 'position' => 64, + 'type' => DocLexer::T_COMMA, + ), + array( + 'value' => '\\Doctrine\\Tests\\Common\\Annotations\\Fixtures\\IntefaceWithConstants::SOME_VALUE', + 'position' => 66, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => ')', + 'position' => 143, + 'type' => DocLexer::T_CLOSE_PARENTHESIS, + ) + + ); + + $lexer->setInput($docblock); + + foreach ($tokens as $expected) { + $lexer->moveNext(); + $lookahead = $lexer->lookahead; + $this->assertEquals($expected['value'], $lookahead['value']); + $this->assertEquals($expected['type'], $lookahead['type']); + $this->assertEquals($expected['position'], $lookahead['position']); + } + + $this->assertFalse($lexer->moveNext()); + } + + + public function testScannerTokenizesDocBlockWhitInvalidIdentifier() + { + $lexer = new DocLexer(); + $docblock = '@Foo\3.42'; + + $tokens = array ( + array( + 'value' => '@', + 'position' => 0, + 'type' => DocLexer::T_AT, + ), + array( + 'value' => 'Foo', + 'position' => 1, + 'type' => DocLexer::T_IDENTIFIER, + ), + array( + 'value' => '\\', + 'position' => 4, + 'type' => DocLexer::T_NAMESPACE_SEPARATOR, + ), + array( + 'value' => 3.42, + 'position' => 5, + 'type' => DocLexer::T_FLOAT, + ) + ); + + $lexer->setInput($docblock); + + foreach ($tokens as $expected) { + $lexer->moveNext(); + $lookahead = $lexer->lookahead; + $this->assertEquals($expected['value'], $lookahead['value']); + $this->assertEquals($expected['type'], $lookahead['type']); + $this->assertEquals($expected['position'], $lookahead['position']); + } + + $this->assertFalse($lexer->moveNext()); + } + } \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php index 56cae7f..b14698f 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php @@ -7,6 +7,9 @@ use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation; use Doctrine\Common\Annotations\DocParser; use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\Annotations\Annotation\Target; +use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants; +use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants; +use Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants; class DocParserTest extends \PHPUnit_Framework_TestCase { @@ -662,6 +665,93 @@ DOCBLOCK; } + public function getConstantsProvider() + { + $provider[] = array( + '@AnnotationWithConstants(PHP_EOL)', + PHP_EOL + ); + $provider[] = array( + '@AnnotationWithConstants(AnnotationWithConstants::INTEGER)', + AnnotationWithConstants::INTEGER + ); + $provider[] = array( + '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants(AnnotationWithConstants::STRING)', + AnnotationWithConstants::STRING + ); + $provider[] = array( + '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants::FLOAT)', + AnnotationWithConstants::FLOAT + ); + $provider[] = array( + '@AnnotationWithConstants(ClassWithConstants::SOME_VALUE)', + ClassWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants(Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_VALUE)', + ClassWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants(IntefaceWithConstants::SOME_VALUE)', + IntefaceWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants(\Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_VALUE)', + IntefaceWithConstants::SOME_VALUE + ); + $provider[] = array( + '@AnnotationWithConstants({AnnotationWithConstants::STRING, AnnotationWithConstants::INTEGER, AnnotationWithConstants::FLOAT})', + array(AnnotationWithConstants::STRING, AnnotationWithConstants::INTEGER, AnnotationWithConstants::FLOAT) + ); + $provider[] = array( + '@AnnotationWithConstants({ + AnnotationWithConstants::STRING = AnnotationWithConstants::INTEGER + })', + array(AnnotationWithConstants::STRING => AnnotationWithConstants::INTEGER) + ); + $provider[] = array( + '@AnnotationWithConstants({ + Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_KEY = AnnotationWithConstants::INTEGER + })', + array(IntefaceWithConstants::SOME_KEY => AnnotationWithConstants::INTEGER) + ); + $provider[] = array( + '@AnnotationWithConstants({ + \Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants::SOME_KEY = AnnotationWithConstants::INTEGER + })', + array(IntefaceWithConstants::SOME_KEY => AnnotationWithConstants::INTEGER) + ); + $provider[] = array( + '@AnnotationWithConstants({ + AnnotationWithConstants::STRING = AnnotationWithConstants::INTEGER, + ClassWithConstants::SOME_KEY = ClassWithConstants::SOME_VALUE, + Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants::SOME_KEY = IntefaceWithConstants::SOME_VALUE + })', + array( + AnnotationWithConstants::STRING => AnnotationWithConstants::INTEGER, + ClassWithConstants::SOME_KEY => ClassWithConstants::SOME_VALUE, + ClassWithConstants::SOME_KEY => IntefaceWithConstants::SOME_VALUE + ) + ); + return $provider; + } + + /** + * @dataProvider getConstantsProvider + */ + public function testSupportClassConstants($docblock, $expected) + { + $parser = $this->createTestParser(); + $parser->setImports(array( + 'classwithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\ClassWithConstants', + 'intefacewithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\IntefaceWithConstants', + 'annotationwithconstants' => 'Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants' + )); + + $result = $parser->parse($docblock); + $this->assertInstanceOf('\Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants', $annotation = $result[0]); + $this->assertEquals($expected, $annotation->value); + } /** * @expectedException Doctrine\Common\Annotations\AnnotationException @@ -1045,9 +1135,9 @@ DOCBLOCK; /** * @expectedException Doctrine\Common\Annotations\AnnotationException - * @expectedExceptionMessage [Syntax Error] Expected PlainValue, got 'foo:' at position 6. + * @expectedExceptionMessage [Semantical Error] Couldn't find constant foo. */ - public function testColonNotAllowedOnTopLevel() + public function testInvalidContantName() { $parser = $this->createTestParser(); $parser->parse('@Name(foo: "bar")'); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php new file mode 100644 index 0000000..17223f6 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php @@ -0,0 +1,48 @@ +events->filter(function ($item) use ($year, $month, $day) { + $leftDate = new \DateTime($year.'-'.$month.'-'.$day.' 00:00'); + $rigthDate = new \DateTime($year.'-'.$month.'-'.$day.' +1 day 00:00'); + return ( ( $leftDate <= $item->getDateStart() ) && ( $item->getDateStart() < $rigthDate ) ); + + } + ); + return $extractEvents; + } + +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php new file mode 100644 index 0000000..055e245 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/ClassWithConstants.php @@ -0,0 +1,10 @@ + __NAMESPACE__ . '\Fixtures\Annotation\Template', ), $parser->parseClass($class)); } + + /** + * @group DCOM-97 + * @group regression + */ + public function testClassWithClosure() + { + $parser = new PhpParser(); + $class = new ReflectionClass(__NAMESPACE__ . '\Fixtures\ClassWithClosure'); + + $this->assertEquals(array( + 'annotationtargetall' => __NAMESPACE__ . '\Fixtures\AnnotationTargetAll', + 'annotationtargetannotation' => __NAMESPACE__ . '\Fixtures\AnnotationTargetAnnotation', + ), $parser->parseClass($class)); + } } \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php index 7192717..6cad891 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php @@ -10,4 +10,12 @@ class ArrayCacheTest extends CacheTest { return new ArrayCache(); } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } } \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php index 2ae15f2..1bbc165 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php @@ -25,6 +25,15 @@ abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase $this->assertFalse($cache->contains('test_key2')); } + public function testObjects() + { + $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); + } + public function testDeleteAll() { $cache = $this->_getCacheDriver(); @@ -65,14 +74,9 @@ abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase */ public function testGetStats() { - if ($this instanceof ArrayCacheTest || $this instanceof ZendDataCacheTest ) { - $this->markTestSkipped("Statistics are not available for this driver"); - } - $cache = $this->_getCacheDriver(); $stats = $cache->getStats(); - $this->assertArrayHasKey(Cache::STATS_HITS, $stats); $this->assertArrayHasKey(Cache::STATS_MISSES, $stats); $this->assertArrayHasKey(Cache::STATS_UPTIME, $stats); @@ -84,4 +88,4 @@ abstract class CacheTest extends \Doctrine\Tests\DoctrineTestCase * @return \Doctrine\Common\Cache\CacheProvider */ abstract protected function _getCacheDriver(); -} \ No newline at end of file +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php new file mode 100644 index 0000000..f782e3c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php @@ -0,0 +1,97 @@ +assertFalse(is_dir($dir)); + + $this->driver = new FilesystemCache($dir); + $this->assertTrue(is_dir($dir)); + + return $this->driver; + } + + public function testLifetime() + { + $cache = $this->_getCacheDriver(); + + // Test save + $cache->save('test_key', 'testing this out', 10); + + // Test contains to test that save() worked + $this->assertTrue($cache->contains('test_key')); + + // Test fetch + $this->assertEquals('testing this out', $cache->fetch('test_key')); + + // access private methods + $getFilename = new \ReflectionMethod($cache, 'getFilename'); + $getNamespacedId = new \ReflectionMethod($cache, 'getNamespacedId'); + + $getFilename->setAccessible(true); + $getNamespacedId->setAccessible(true); + + $id = $getNamespacedId->invoke($cache, 'test_key'); + $filename = $getFilename->invoke($cache, $id); + + $data = ''; + $lifetime = 0; + $resource = fopen($filename, "r"); + + if (false !== ($line = fgets($resource))) { + $lifetime = (integer) $line; + } + + while (false !== ($line = fgets($resource))) { + $data .= $line; + } + + $this->assertNotEquals(0, $lifetime, "previous lifetime could not be loaded"); + + // update lifetime + $lifetime = $lifetime - 20; + file_put_contents($filename, $lifetime . PHP_EOL . $data); + + // test expired data + $this->assertFalse($cache->contains('test_key')); + $this->assertFalse($cache->fetch('test_key')); + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + + public function tearDown() + { + $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()); + } + } + } + +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php index 362ff69..36c180c 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php @@ -28,6 +28,13 @@ class MemcacheCacheTest extends CacheTest $this->assertTrue($cache->contains('noexpire'), 'Memcache provider should support no-expire'); } + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + $this->assertTrue($cache->contains('key'), 'Memcache provider should support TTL > 30 days'); + } + protected function _getCacheDriver() { $driver = new MemcacheCache(); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php index 947ba75..ecbe5a6 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php @@ -31,6 +31,14 @@ class MemcachedCacheTest extends CacheTest $this->assertTrue($cache->contains('noexpire'), 'Memcache provider should support no-expire'); } + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + + $this->assertTrue($cache->contains('key'), 'Memcached provider should support TTL > 30 days'); + } + protected function _getCacheDriver() { $driver = new MemcachedCache(); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php new file mode 100644 index 0000000..5085f46 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php @@ -0,0 +1,149 @@ +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(); + + // Test save + $cache->save('test_key', 'testing this out', 10); + + // Test contains to test that save() worked + $this->assertTrue($cache->contains('test_key')); + + // Test fetch + $this->assertEquals('testing this out', $cache->fetch('test_key')); + + // access private methods + $getFilename = new \ReflectionMethod($cache, 'getFilename'); + $getNamespacedId = new \ReflectionMethod($cache, 'getNamespacedId'); + + $getFilename->setAccessible(true); + $getNamespacedId->setAccessible(true); + + $id = $getNamespacedId->invoke($cache, 'test_key'); + $path = $getFilename->invoke($cache, $id); + $value = include $path; + + // update lifetime + $value['lifetime'] = $value['lifetime'] - 20; + file_put_contents($path, 'assertFalse($cache->contains('test_key')); + $this->assertFalse($cache->fetch('test_key')); + } + + public function testImplementsSetState() + { + $cache = $this->_getCacheDriver(); + + // Test save + $cache->save('test_set_state', new SetStateClass(array(1,2,3))); + + //Test __set_state call + $this->assertCount(0, SetStateClass::$values); + + // Test fetch + $value = $cache->fetch('test_set_state'); + $this->assertInstanceOf('Doctrine\Tests\Common\Cache\SetStateClass', $value); + $this->assertEquals(array(1,2,3), $value->getValue()); + + //Test __set_state call + $this->assertCount(1, SetStateClass::$values); + + // Test contains + $this->assertTrue($cache->contains('test_set_state')); + } + + public function testNotImplementsSetState() + { + $cache = $this->_getCacheDriver(); + + $this->setExpectedException('InvalidArgumentException'); + $cache->save('test_not_set_state', new NotSetStateClass(array(1,2,3))); + } + + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + + public function tearDown() + { + 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()); + } + } + } + +} + +class NotSetStateClass +{ + private $value; + + public function __construct($value) + { + $this->value = $value; + } + + public function getValue() + { + return $this->value; + } +} + +class SetStateClass extends NotSetStateClass +{ + public static $values = array(); + + public static function __set_state($data) + { + self::$values = $data; + return new self($data['value']); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php new file mode 100644 index 0000000..45bbc75 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php @@ -0,0 +1,30 @@ +_redis = new \Redis(); + $ok = @$this->_redis->connect('127.0.0.1'); + if (!$ok) { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } else { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of redis'); + } + } + + protected function _getCacheDriver() + { + $driver = new RedisCache(); + $driver->setRedis($this->_redis); + return $driver; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php index 27dcf35..cd66e15 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php @@ -13,6 +13,14 @@ class ZendDataCacheTest extends CacheTest } } + public function testGetStats() + { + $cache = $this->_getCacheDriver(); + $stats = $cache->getStats(); + + $this->assertNull($stats); + } + protected function _getCacheDriver() { return new ZendDataCache(); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php new file mode 100644 index 0000000..e40afba --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php @@ -0,0 +1,198 @@ +. + */ + +namespace Doctrine\Tests\Common\Collections; + +use Doctrine\Common\Collections\Expr\ClosureExpressionVisitor; +use Doctrine\Common\Collections\ExpressionBuilder; + +/** + * @group DDC-1637 + */ +class ClosureExpressionVisitorTest extends \PHPUnit_Framework_TestCase +{ + private $visitor; + private $builder; + + public function setUp() + { + $this->visitor = new ClosureExpressionVisitor(); + $this->builder = new ExpressionBuilder(); + } + + public function testWalkEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->eq("foo", 1)); + + $this->assertTrue($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(2))); + } + + public function testWalkNotEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->neq("foo", 1)); + + $this->assertFalse($closure(new TestObject(1))); + $this->assertTrue($closure(new TestObject(2))); + } + + public function testWalkLessThanComparison() + { + $closure = $this->visitor->walkComparison($this->builder->lt("foo", 1)); + + $this->assertFalse($closure(new TestObject(1))); + $this->assertTrue($closure(new TestObject(0))); + } + + public function testWalkLessThanEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->lte("foo", 1)); + + $this->assertFalse($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(1))); + $this->assertTrue($closure(new TestObject(0))); + } + + public function testWalkGreaterThanEqualsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->gte("foo", 1)); + + $this->assertTrue($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(0))); + } + + public function testWalkGreaterThanComparison() + { + $closure = $this->visitor->walkComparison($this->builder->gt("foo", 1)); + + $this->assertTrue($closure(new TestObject(2))); + $this->assertFalse($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(0))); + } + + public function testWalkInComparison() + { + $closure = $this->visitor->walkComparison($this->builder->in("foo", array(1, 2, 3))); + + $this->assertTrue($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(0))); + } + + public function testWalkNotInComparison() + { + $closure = $this->visitor->walkComparison($this->builder->notIn("foo", array(1, 2, 3))); + + $this->assertFalse($closure(new TestObject(1))); + $this->assertFalse($closure(new TestObject(2))); + $this->assertTrue($closure(new TestObject(0))); + $this->assertTrue($closure(new TestObject(4))); + } + + public function testWalkAndCompositeExpression() + { + $closure = $this->visitor->walkCompositeExpression( + $this->builder->andX( + $this->builder->eq("foo", 1), + $this->builder->eq("bar", 1) + ) + ); + + $this->assertTrue($closure(new TestObject(1, 1))); + $this->assertFalse($closure(new TestObject(1, 0))); + $this->assertFalse($closure(new TestObject(0, 1))); + $this->assertFalse($closure(new TestObject(0, 0))); + } + + public function testWalkOrCompositeExpression() + { + $closure = $this->visitor->walkCompositeExpression( + $this->builder->orX( + $this->builder->eq("foo", 1), + $this->builder->eq("bar", 1) + ) + ); + + $this->assertTrue($closure(new TestObject(1, 1))); + $this->assertTrue($closure(new TestObject(1, 0))); + $this->assertTrue($closure(new TestObject(0, 1))); + $this->assertFalse($closure(new TestObject(0, 0))); + } + + public function testSortByFieldAscending() + { + $objects = array(new TestObject("b"), new TestObject("a"), new TestObject("c")); + $sort = ClosureExpressionVisitor::sortByField("foo"); + + usort($objects, $sort); + + $this->assertEquals("a", $objects[0]->getFoo()); + $this->assertEquals("b", $objects[1]->getFoo()); + $this->assertEquals("c", $objects[2]->getFoo()); + } + + public function testSortByFieldDescending() + { + $objects = array(new TestObject("b"), new TestObject("a"), new TestObject("c")); + $sort = ClosureExpressionVisitor::sortByField("foo", -1); + + usort($objects, $sort); + + $this->assertEquals("c", $objects[0]->getFoo()); + $this->assertEquals("b", $objects[1]->getFoo()); + $this->assertEquals("a", $objects[2]->getFoo()); + } + + public function testSortDelegate() + { + $objects = array(new TestObject("a", "c"), new TestObject("a", "b"), new TestObject("a", "a")); + $sort = ClosureExpressionVisitor::sortByField("bar", 1); + $sort = ClosureExpressionVisitor::sortByField("foo", 1, $sort); + + usort($objects, $sort); + + $this->assertEquals("a", $objects[0]->getBar()); + $this->assertEquals("b", $objects[1]->getBar()); + $this->assertEquals("c", $objects[2]->getBar()); + } +} + +class TestObject +{ + private $foo; + private $bar; + + public function __construct($foo = null, $bar = null) + { + $this->foo = $foo; + $this->bar = $bar; + } + + public function getFoo() + { + return $this->foo; + } + + public function getBar() + { + return $this->bar; + } +} + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php index 8c2bb3c..58979fa 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php @@ -3,6 +3,7 @@ namespace Doctrine\Tests\Common\Collections; use Doctrine\Tests; +use Doctrine\Common\Collections\Criteria; class CollectionTest extends \Doctrine\Tests\DoctrineTestCase { @@ -192,4 +193,59 @@ class CollectionTest extends \Doctrine\Tests\DoctrineTestCase $slice = $this->_coll->slice(1, 1); $this->assertEquals(array(1 => 'two'), $slice); } -} \ No newline at end of file + + public function fillMatchingFixture() + { + $std1 = new \stdClass(); + $std1->foo = "bar"; + $this->_coll[] = $std1; + + $std2 = new \stdClass(); + $std2->foo = "baz"; + $this->_coll[] = $std2; + } + + /** + * @group DDC-1637 + */ + public function testMatching() + { + $this->fillMatchingFixture(); + + $col = $this->_coll->matching(new Criteria($this->_coll->expr()->eq("foo", "bar"))); + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); + $this->assertNotSame($col, $this->_coll); + $this->assertEquals(1, count($col)); + } + + /** + * @group DDC-1637 + */ + public function testMatchingOrdering() + { + $this->fillMatchingFixture(); + + $col = $this->_coll->matching(new Criteria(null, array('foo' => 'DESC'))); + + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); + $this->assertNotSame($col, $this->_coll); + $this->assertEquals(2, count($col)); + $this->assertEquals('baz', $col[0]->foo); + $this->assertEquals('bar', $col[1]->foo); + } + + /** + * @group DDC-1637 + */ + public function testMatchingSlice() + { + $this->fillMatchingFixture(); + + $col = $this->_coll->matching(new Criteria(null, null, 1, 1)); + + $this->assertInstanceOf('Doctrine\Common\Collections\Collection', $col); + $this->assertNotSame($col, $this->_coll); + $this->assertEquals(1, count($col)); + $this->assertEquals('baz', $col[0]->foo); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php new file mode 100644 index 0000000..a7415f2 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php @@ -0,0 +1,38 @@ + "ASC"), 10, 20); + + $this->assertSame($expr, $criteria->getWhereExpression()); + $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings()); + $this->assertEquals(10, $criteria->getFirstResult()); + $this->assertEquals(20, $criteria->getMaxResults()); + } + + public function testWhere() + { + $expr = new Comparison("field", "=", "value"); + $criteria = new Criteria(); + + $criteria->where($expr); + + $this->assertSame($expr, $criteria->getWhereExpression()); + } + + public function testOrderings() + { + $criteria = new Criteria(); + + $criteria->orderBy(array("foo" => "ASC")); + + $this->assertEquals(array("foo" => "ASC"), $criteria->getOrderings()); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php new file mode 100644 index 0000000..68896b3 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php @@ -0,0 +1,114 @@ +builder = new ExpressionBuilder(); + } + + public function testAndX() + { + $expr = $this->builder->andX($this->builder->eq("a", "b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\CompositeExpression", $expr); + $this->assertEquals(CompositeExpression::TYPE_AND, $expr->getType()); + } + + public function testOrX() + { + $expr = $this->builder->orX($this->builder->eq("a", "b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\CompositeExpression", $expr); + $this->assertEquals(CompositeExpression::TYPE_OR, $expr->getType()); + } + + public function testInvalidAndXArgument() + { + $this->setExpectedException("RuntimeException"); + $this->builder->andX("foo"); + } + + public function testEq() + { + $expr = $this->builder->eq("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::EQ, $expr->getOperator()); + } + + public function testNeq() + { + $expr = $this->builder->neq("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::NEQ, $expr->getOperator()); + } + + public function testLt() + { + $expr = $this->builder->lt("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::LT, $expr->getOperator()); + } + + public function testGt() + { + $expr = $this->builder->gt("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::GT, $expr->getOperator()); + } + + public function testGte() + { + $expr = $this->builder->gte("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::GTE, $expr->getOperator()); + } + + public function testLte() + { + $expr = $this->builder->lte("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::LTE, $expr->getOperator()); + } + + public function testIn() + { + $expr = $this->builder->in("a", array("b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::IN, $expr->getOperator()); + } + + public function testNotIn() + { + $expr = $this->builder->notIn("a", array("b")); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::NIN, $expr->getOperator()); + } + + public function testIsNull() + { + $expr = $this->builder->isNull("a"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::IS, $expr->getOperator()); + } +} + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php index e1825ae..66ad762 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ChainDriverTest.php @@ -86,6 +86,42 @@ class DriverChainTest extends DoctrineTestCase $this->assertTrue($chain->isTransient('stdClass'), "stdClass isTransient"); } + + /** + * @group DDC-1412 + */ + public function testDefaultDriver() + { + $companyDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $dafaultDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $entityClassName = 'Doctrine\Tests\ORM\Mapping\DriverChainEntity'; + $managerClassName = 'Doctrine\Tests\Models\Company\CompanyManager'; + $chain = new MappingDriverChain(); + + $companyDriver->expects($this->never()) + ->method('loadMetadataForClass'); + $companyDriver->expects($this->once()) + ->method('isTransient') + ->with($this->equalTo($managerClassName)) + ->will($this->returnValue(false)); + + $dafaultDriver->expects($this->never()) + ->method('loadMetadataForClass'); + $dafaultDriver->expects($this->once()) + ->method('isTransient') + ->with($this->equalTo($entityClassName)) + ->will($this->returnValue(true)); + + $this->assertNull($chain->getDefaultDriver()); + + $chain->setDefaultDriver($dafaultDriver); + $chain->addDriver($companyDriver, 'Doctrine\Tests\Models\Company'); + + $this->assertSame($dafaultDriver, $chain->getDefaultDriver()); + + $this->assertTrue($chain->isTransient($entityClassName)); + $this->assertFalse($chain->isTransient($managerClassName)); + } } class DriverChainEntity diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php index 9fe3299..bc1559a 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/ClassMetadataFactoryTest.php @@ -90,7 +90,7 @@ class TestClassMetadataFactory extends AbstractClassMetadataFactory $this->metadata = $metadata; } - protected function doLoadMetadata($class, $parent, $rootEntityFound) + protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents) { } @@ -121,6 +121,11 @@ class TestClassMetadataFactory extends AbstractClassMetadataFactory protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService) { } + + protected function isEntity(ClassMetadata $class) + { + return true; + } } class RootEntity diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php index 3c600c4..37072de 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/DefaultFileLocatorTest.php @@ -40,7 +40,7 @@ class DefaultFileLocatorTest extends DoctrineTestCase $locator = new DefaultFileLocator(array($path), ".yml"); - $this->assertEquals(__DIR__ . '/_files/stdClass.yml', $locator->findMappingFile('stdClass')); + $this->assertEquals(__DIR__ . '/_files' . DIRECTORY_SEPARATOR . 'stdClass.yml', $locator->findMappingFile('stdClass')); } public function testFindMappingFileNotFound() diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/DeeperNamespaceParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/DeeperNamespaceParent.php new file mode 100644 index 0000000..72faa77 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/DeeperNamespaceParent.php @@ -0,0 +1,7 @@ + array($testsRoot), + ); + $noParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\NoParent'; + $staticReflectionParser = new StaticReflectionParser($noParentClassName, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($noParentClassName, $declaringClassName); + + $className = 'Doctrine\\Tests\\Common\\Reflection\\FullyClassifiedParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($noParentClassName, $declaringClassName); + + $className = 'Doctrine\\Tests\\Common\\Reflection\\SameNamespaceParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($noParentClassName, $declaringClassName); + + $dummyParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\Dummies\\NoParent'; + + $className = 'Doctrine\\Tests\\Common\\Reflection\\DeeperNamespaceParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($dummyParentClassName, $declaringClassName); + + $className = 'Doctrine\\Tests\\Common\\Reflection\\UseParent'; + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); + $this->assertEquals($dummyParentClassName, $declaringClassName); + + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/UseParent.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/UseParent.php new file mode 100644 index 0000000..dd512d4 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/UseParent.php @@ -0,0 +1,9 @@ +getName(), $declared)) { + continue; } - $r = new \ReflectionClass($class); - $files[] = $r->getFileName(); + $files[] = $class->getFileName(); - $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($r->getFileName())); + $c = preg_replace(array('/^\s*<\?php/', '/\?>\s*$/'), '', file_get_contents($class->getFileName())); // add namespace declaration for global code - if (!$r->inNamespace()) { + if (!$class->inNamespace()) { $c = "\nnamespace\n{\n".self::stripComments($c)."\n}\n"; } else { $c = self::fixNamespaceDeclarations('getName()])) { + return array(); + } + + self::$seen[$class->getName()] = true; + + $classes = array($class); + $parent = $class; + while (($parent = $parent->getParentClass()) && $parent->isUserDefined() && !isset(self::$seen[$parent->getName()])) { + self::$seen[$parent->getName()] = true; + + array_unshift($classes, $parent); + } + + if (function_exists('get_declared_traits')) { + foreach ($classes as $c) { + foreach (self::getTraits($c) as $trait) { + self::$seen[$trait->getName()] = true; + + array_unshift($classes, $trait); + } + } + } + + return array_merge(self::getInterfaces($class), $classes); + } + + private static function getInterfaces(\ReflectionClass $class) + { + $classes = array(); + + foreach ($class->getInterfaces() as $interface) { + $classes = array_merge($classes, self::getInterfaces($interface)); + } + + if ($class->isUserDefined() && $class->isInterface() && !isset(self::$seen[$class->getName()])) { + self::$seen[$class->getName()] = true; + + $classes[] = $class; + } + + return $classes; + } + + private static function getTraits(\ReflectionClass $class) + { + $traits = $class->getTraits(); + $classes = array(); + while ($trait = array_pop($traits)) { + if ($trait->isUserDefined() && !isset(self::$seen[$trait->getName()])) { + $classes[] = $trait; + + $traits = array_merge($traits, $trait->getTraits()); + } + } + + return $classes; + } } diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php index 91ea9af..b0e6580 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -24,7 +24,7 @@ class ClassMapGenerator * @param array|string $dirs Directories or a single path to search in * @param string $file The name of the class map file */ - static public function dump($dirs, $file) + public static function dump($dirs, $file) { $dirs = (array) $dirs; $maps = array(); @@ -43,7 +43,7 @@ class ClassMapGenerator * * @return array A class map array */ - static public function createMap($dir) + public static function createMap($dir) { if (is_string($dir)) { $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir)); @@ -80,7 +80,7 @@ class ClassMapGenerator * * @return array The found classes */ - static private function findClasses($path) + private static function findClasses($path) { $contents = file_get_contents($path); $tokens = token_get_all($contents); diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php index da7d289..dbfb5ab 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php @@ -42,7 +42,7 @@ class DebugClassLoader /** * Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper. */ - static public function enable() + public static function enable() { if (!is_array($functions = spl_autoload_functions())) { return; diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php index 8cc6747..96c6290 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php @@ -21,7 +21,7 @@ class DebugUniversalClassLoader extends UniversalClassLoader /** * Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. */ - static public function enable() + public static function enable() { if (!is_array($functions = spl_autoload_functions())) { return; diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index 5f4db1f..90eca1d 100644 --- a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -13,8 +13,110 @@ namespace Symfony\Component\ClassLoader\Tests; use Symfony\Component\ClassLoader\ClassCollectionLoader; +require_once __DIR__.'/Fixtures/ClassesWithParents/GInterface.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/CInterface.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/B.php'; +require_once __DIR__.'/Fixtures/ClassesWithParents/A.php'; + class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase { + /** + * @dataProvider getDifferentOrders + */ + public function testClassReordering(array $classes) + { + $expected = array( + 'ClassesWithParents\\GInterface', + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + ); + + $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); + $m = $r->getMethod('getOrderedClasses'); + $m->setAccessible(true); + + $ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes); + + $this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered)); + } + + public function getDifferentOrders() + { + return array( + array(array( + 'ClassesWithParents\\A', + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\GInterface', + 'ClassesWithParents\\B', + )), + array(array( + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + 'ClassesWithParents\\CInterface', + )), + array(array( + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + )), + array(array( + 'ClassesWithParents\\A', + )), + ); + } + + /** + * @dataProvider getDifferentOrdersForTraits + */ + public function testClassWithTraitsReordering(array $classes) + { + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->markTestSkipped('Requires PHP > 5.4.0.'); + + return; + } + + require_once __DIR__.'/Fixtures/ClassesWithParents/ATrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/BTrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/CTrait.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/D.php'; + require_once __DIR__.'/Fixtures/ClassesWithParents/E.php'; + + $expected = array( + 'ClassesWithParents\\GInterface', + 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\CTrait', + 'ClassesWithParents\\ATrait', + 'ClassesWithParents\\BTrait', + 'ClassesWithParents\\B', + 'ClassesWithParents\\A', + 'ClassesWithParents\\D', + 'ClassesWithParents\\E', + ); + + $r = new \ReflectionClass('Symfony\Component\ClassLoader\ClassCollectionLoader'); + $m = $r->getMethod('getOrderedClasses'); + $m->setAccessible(true); + + $ordered = $m->invoke('Symfony\Component\ClassLoader\ClassCollectionLoader', $classes); + + $this->assertEquals($expected, array_map(function ($class) { return $class->getName(); }, $ordered)); + } + + public function getDifferentOrdersForTraits() + { + return array( + array(array( + 'ClassesWithParents\\E', + 'ClassesWithParents\\ATrait', + )), + array(array( + 'ClassesWithParents\\E', + )), + ); + } + public function testFixNamespaceDeclarations() { $source = <<=5.3.3" }, diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md index 96839e9..8f5d6b3 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -10,3 +10,6 @@ CHANGELOG * added Definition::clearTag() * component exceptions that inherit base SPL classes are now used exclusively (this includes dumped containers) + * [BC BREAK] fixed unescaping of class arguments, method + ParameterBag::unescapeValue() was made public + diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php index 1ae8bb9..beacda9 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php @@ -29,5 +29,5 @@ interface CompilerPassInterface * * @api */ - function process(ContainerBuilder $container); + public function process(ContainerBuilder $container); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php index 0c6c90d..6bd6161 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php @@ -11,7 +11,6 @@ namespace Symfony\Component\DependencyInjection\Compiler; - /** * Used to format logging messages during the compilation. * diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php index 81209c3..d60ae35 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php @@ -24,5 +24,5 @@ interface RepeatablePassInterface extends CompilerPassInterface * * @param RepeatedPass $repeatedPass */ - function setRepeatedPass(RepeatedPass $repeatedPass); + public function setRepeatedPass(RepeatedPass $repeatedPass); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php index 8500644..88e1f26 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php @@ -220,8 +220,8 @@ class Container implements IntrospectableContainerInterface /** * Gets a service. * - * If a service is both defined through a set() method and - * with a set*Service() method, the former has always precedence. + * If a service is defined both through a set() method and + * with a get{$id}Service() method, the former has always precedence. * * @param string $id The service identifier * @param integer $invalidBehavior The behavior when the service does not exist @@ -448,7 +448,7 @@ class Container implements IntrospectableContainerInterface * * @return string The camelized string */ - static public function camelize($id) + public static function camelize($id) { return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id); } @@ -460,7 +460,7 @@ class Container implements IntrospectableContainerInterface * * @return string The underscored string */ - static public function underscore($id) + public static function underscore($id) { return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php index 1879ec0..eb96632 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php @@ -27,5 +27,5 @@ interface ContainerAwareInterface * * @api */ - function setContainer(ContainerInterface $container = null); + public function setContainer(ContainerInterface $container = null); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php index a706229..692cf91 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -728,24 +728,28 @@ class ContainerBuilder extends Container implements TaggedContainerInterface */ private function createService(Definition $definition, $id) { + $parameterBag = $this->getParameterBag(); + if (null !== $definition->getFile()) { - require_once $this->getParameterBag()->resolveValue($definition->getFile()); + require_once $parameterBag->resolveValue($definition->getFile()); } - $arguments = $this->resolveServices($this->getParameterBag()->resolveValue($definition->getArguments())); + $arguments = $this->resolveServices( + $parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())) + ); if (null !== $definition->getFactoryMethod()) { if (null !== $definition->getFactoryClass()) { - $factory = $this->getParameterBag()->resolveValue($definition->getFactoryClass()); + $factory = $parameterBag->resolveValue($definition->getFactoryClass()); } elseif (null !== $definition->getFactoryService()) { - $factory = $this->get($this->getParameterBag()->resolveValue($definition->getFactoryService())); + $factory = $this->get($parameterBag->resolveValue($definition->getFactoryService())); } else { throw new RuntimeException('Cannot create service from factory method without a factory service or factory class.'); } $service = call_user_func_array(array($factory, $definition->getFactoryMethod()), $arguments); } else { - $r = new \ReflectionClass($this->getParameterBag()->resolveValue($definition->getClass())); + $r = new \ReflectionClass($parameterBag->resolveValue($definition->getClass())); $service = null === $r->getConstructor() ? $r->newInstance() : $r->newInstanceArgs($arguments); } @@ -774,11 +778,11 @@ class ContainerBuilder extends Container implements TaggedContainerInterface } if ($ok) { - call_user_func_array(array($service, $call[0]), $this->resolveServices($this->getParameterBag()->resolveValue($call[1]))); + call_user_func_array(array($service, $call[0]), $this->resolveServices($parameterBag->resolveValue($call[1]))); } } - $properties = $this->resolveServices($this->getParameterBag()->resolveValue($definition->getProperties())); + $properties = $this->resolveServices($parameterBag->resolveValue($definition->getProperties())); foreach ($properties as $name => $value) { $service->$name = $value; } @@ -787,7 +791,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface if (is_array($callable) && is_object($callable[0]) && $callable[0] instanceof Reference) { $callable[0] = $this->get((string) $callable[0]); } elseif (is_array($callable)) { - $callable[0] = $this->getParameterBag()->resolveValue($callable[0]); + $callable[0] = $parameterBag->resolveValue($callable[0]); } if (!is_callable($callable)) { @@ -850,7 +854,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * * @return array An array of Service conditionals */ - static public function getServiceConditionals($value) + public static function getServiceConditionals($value) { $services = array(); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php index 6a5988e..d5e07a0 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -38,7 +38,7 @@ interface ContainerInterface * * @api */ - function set($id, $service, $scope = self::SCOPE_CONTAINER); + public function set($id, $service, $scope = self::SCOPE_CONTAINER); /** * Gets a service. @@ -54,7 +54,7 @@ interface ContainerInterface * * @api */ - function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); /** * Returns true if the given service is defined. @@ -65,7 +65,7 @@ interface ContainerInterface * * @api */ - function has($id); + public function has($id); /** * Gets a parameter. @@ -78,7 +78,7 @@ interface ContainerInterface * * @api */ - function getParameter($name); + public function getParameter($name); /** * Checks if a parameter exists. @@ -89,7 +89,7 @@ interface ContainerInterface * * @api */ - function hasParameter($name); + public function hasParameter($name); /** * Sets a parameter. @@ -99,7 +99,7 @@ interface ContainerInterface * * @api */ - function setParameter($name, $value); + public function setParameter($name, $value); /** * Enters the given scope @@ -108,7 +108,7 @@ interface ContainerInterface * * @api */ - function enterScope($name); + public function enterScope($name); /** * Leaves the current scope, and re-enters the parent scope @@ -117,7 +117,7 @@ interface ContainerInterface * * @api */ - function leaveScope($name); + public function leaveScope($name); /** * Adds a scope to the container @@ -126,7 +126,7 @@ interface ContainerInterface * * @api */ - function addScope(ScopeInterface $scope); + public function addScope(ScopeInterface $scope); /** * Whether this container has the given scope @@ -137,7 +137,7 @@ interface ContainerInterface * * @api */ - function hasScope($name); + public function hasScope($name); /** * Determines whether the given scope is currently active. @@ -150,5 +150,5 @@ interface ContainerInterface * * @api */ - function isScopeActive($name); + public function isScopeActive($name); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php index 6972cbf..ba146f6 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php @@ -29,5 +29,5 @@ interface DumperInterface * * @api */ - function dump(array $options = array()); + public function dump(array $options = array()); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 113a242..d8791ce 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -281,7 +281,7 @@ class XmlDumper extends Dumper * * @param mixed $value Value to convert */ - static public function phpToXml($value) + public static function phpToXml($value) { switch (true) { case null === $value: diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php index 4f33a9b..1d96d24 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php @@ -28,5 +28,5 @@ interface ConfigurationExtensionInterface * * @return ConfigurationInterface|null The configuration or null */ - function getConfiguration(array $config, ContainerBuilder $container); + public function getConfiguration(array $config, ContainerBuilder $container); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php index 09ebcd8..fc015e1 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php @@ -32,7 +32,7 @@ interface ExtensionInterface * * @api */ - function load(array $config, ContainerBuilder $container); + public function load(array $config, ContainerBuilder $container); /** * Returns the namespace to be used for this extension (XML namespace). @@ -41,7 +41,7 @@ interface ExtensionInterface * * @api */ - function getNamespace(); + public function getNamespace(); /** * Returns the base path for the XSD files. @@ -50,7 +50,7 @@ interface ExtensionInterface * * @api */ - function getXsdValidationBasePath(); + public function getXsdValidationBasePath(); /** * Returns the recommended alias to use in XML. @@ -61,5 +61,5 @@ interface ExtensionInterface * * @api */ - function getAlias(); + public function getAlias(); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php index 0ffc729..34d6cad 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php @@ -28,6 +28,6 @@ interface IntrospectableContainerInterface extends ContainerInterface * @return Boolean true if the service has been initialized, false otherwise * */ - function initialized($id); + public function initialized($id); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 3a27d37..7525027 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -345,7 +345,7 @@ EOF ; $current = libxml_use_internal_errors(true); - $valid = $dom->schemaValidateSource($source); + $valid = @$dom->schemaValidateSource($source); foreach ($tmpfiles as $tmpfile) { @unlink($tmpfile); } @@ -448,7 +448,7 @@ EOF * * @return array A PHP array */ - static public function convertDomElementToArray(\DomElement $element) + public static function convertDomElementToArray(\DomElement $element) { $empty = true; $config = array(); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index a83f1fc..908e2a1 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -253,7 +253,28 @@ class ParameterBag implements ParameterBagInterface return $this->resolved; } - private function unescapeValue($value) + /** + * {@inheritDoc} + */ + public function escapeValue($value) + { + if (is_string($value)) { + return str_replace('%', '%%', $value); + } + + if (is_array($value)) { + $result = array(); + foreach ($value as $k => $v) { + $result[$k] = $this->escapeValue($v); + } + + return $result; + } + + return $value; + } + + public function unescapeValue($value) { if (is_string($value)) { return str_replace('%%', '%', $value); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php index da83cbe..a26d6ae 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php @@ -27,7 +27,7 @@ interface ParameterBagInterface * * @api */ - function clear(); + public function clear(); /** * Adds parameters to the service container parameters. @@ -36,7 +36,7 @@ interface ParameterBagInterface * * @api */ - function add(array $parameters); + public function add(array $parameters); /** * Gets the service container parameters. @@ -45,7 +45,7 @@ interface ParameterBagInterface * * @api */ - function all(); + public function all(); /** * Gets a service container parameter. @@ -58,7 +58,7 @@ interface ParameterBagInterface * * @api */ - function get($name); + public function get($name); /** * Sets a service container parameter. @@ -68,7 +68,7 @@ interface ParameterBagInterface * * @api */ - function set($name, $value); + public function set($name, $value); /** * Returns true if a parameter name is defined. @@ -79,12 +79,12 @@ interface ParameterBagInterface * * @api */ - function has($name); + public function has($name); /** * Replaces parameter placeholders (%name%) by their values for all parameters. */ - function resolve(); + public function resolve(); /** * Replaces parameter placeholders (%name%) by their values. @@ -93,5 +93,23 @@ interface ParameterBagInterface * * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist */ - function resolveValue($value); + public function resolveValue($value); + + /** + * Escape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + public function escapeValue($value); + + /** + * Unescape parameter placeholders % + * + * @param mixed $value + * + * @return mixed + */ + public function unescapeValue($value); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php index 44b8c5d..81ac67c 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php @@ -23,10 +23,10 @@ interface ScopeInterface /** * @api */ - function getName(); + public function getName(); /** * @api */ - function getParentName(); + public function getParentName(); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php index 457d54f..d154602 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php @@ -99,7 +99,7 @@ class SimpleXMLElement extends \SimpleXMLElement * * @return mixed */ - static public function phpize($value) + public static function phpize($value) { $value = (string) $value; $lowercaseValue = strtolower($value); diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php index 81adb20..3b48817 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php @@ -29,5 +29,5 @@ interface TaggedContainerInterface extends ContainerInterface * * @api */ - function findTaggedServiceIds($name); + public function findTaggedServiceIds($name); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index bedcecb..c9e6b07 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -251,9 +251,9 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase { $builder = new ContainerBuilder(); $builder->register('bar', 'stdClass'); - $builder->register('foo1', 'FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'))); + $builder->register('foo1', 'FooClass')->addArgument(array('foo' => '%value%', '%value%' => 'foo', new Reference('bar'), '%%unescape_it%%')); $builder->setParameter('value', 'bar'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar')), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); + $this->assertEquals(array('foo' => 'bar', 'bar' => 'foo', $builder->get('bar'), '%unescape_it%'), $builder->get('foo1')->arguments, '->createService() replaces parameters and service references in the arguments provided by the service definition'); } /** @@ -550,5 +550,4 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase } } - class FooClass {} diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php index 557c207..ec82cc1 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php @@ -16,7 +16,7 @@ use Symfony\Component\Config\FileLocator; class CrossCheckTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class CrossCheckTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/Fixtures/'; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php index 69e775d..d3b93fd 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper; class GraphvizDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/../Fixtures/'; } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index a072356..c1e2070 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\Definition; class PhpDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -28,7 +28,7 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php index 6618982..b2cddb5 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Dumper\XmlDumper; class XmlDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class XmlDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php index 2dcb3b8..47cc4be 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Dumper\YamlDumper; class YamlDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 3c27376..514df23 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -16,17 +16,17 @@ class BazClass $instance->configure(); } - static public function getInstance() + public static function getInstance() { return new self(); } - static public function configureStatic($instance) + public static function configureStatic($instance) { $instance->configure(); } - static public function configureStatic1() + public static function configureStatic1() { } } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php index 2c53122..180bb38 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php @@ -11,7 +11,7 @@ class FooClass $this->arguments = $arguments; } - static public function getInstance($arguments = array()) + public static function getInstance($arguments = array()) { $obj = new self($arguments); $obj->called = true; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php index 448934c..bba9c8c 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -17,12 +17,12 @@ use Symfony\Component\Config\FileLocator; class IniFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected $container; protected $loader; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 1a157e6..12109c2 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -25,7 +25,7 @@ use Symfony\Component\Config\FileLocator; class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -34,7 +34,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); require_once self::$fixturesPath.'/includes/foo.php'; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 35b5985..e655d3b 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -23,7 +23,7 @@ use Symfony\Component\Config\FileLocator; class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -36,7 +36,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); require_once self::$fixturesPath.'/includes/foo.php'; diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php index 29d2380..46fb358 100644 --- a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php @@ -202,6 +202,22 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase } /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::escapeValue + */ + public function testEscapeValue() + { + $bag = new ParameterBag(); + + $bag->add(array( + 'foo' => $bag->escapeValue(array('bar' => array('ding' => 'I\'m a bar %foo %bar', 'zero' => null))), + 'bar' => $bag->escapeValue('I\'m a %foo%'), + )); + + $this->assertEquals('I\'m a %%foo%%', $bag->get('bar'), '->escapeValue() escapes % by doubling it'); + $this->assertEquals(array('bar' => array('ding' => 'I\'m a bar %%foo %%bar', 'zero' => null)), $bag->get('foo'), '->escapeValue() escapes % by doubling it'); + } + + /** * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::resolve * @dataProvider stringsWithSpacesProvider */ diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md index 9f8c812..536c5ac 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md @@ -13,4 +13,4 @@ CHANGELOG * added GenericEvent event class * added the possibility for subscribers to subscribe several times for the same event - * added UnmodifiableEventDispatcher + * added ImmutableEventDispatcher diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php index 0a53876..a67a979 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php @@ -21,12 +21,12 @@ interface TraceableEventDispatcherInterface * * @return array An array of called listeners */ - function getCalledListeners(); + public function getCalledListeners(); /** * Gets the not called listeners. * * @return array An array of not called listeners */ - function getNotCalledListeners(); + public function getNotCalledListeners(); } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php index e53d71d..7aead23 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php @@ -35,7 +35,7 @@ interface EventDispatcherInterface * * @api */ - function dispatch($eventName, Event $event = null); + public function dispatch($eventName, Event $event = null); /** * Adds an event listener that listens on the specified events. @@ -47,7 +47,7 @@ interface EventDispatcherInterface * * @api */ - function addListener($eventName, $listener, $priority = 0); + public function addListener($eventName, $listener, $priority = 0); /** * Adds an event subscriber. @@ -59,7 +59,7 @@ interface EventDispatcherInterface * * @api */ - function addSubscriber(EventSubscriberInterface $subscriber); + public function addSubscriber(EventSubscriberInterface $subscriber); /** * Removes an event listener from the specified events. @@ -67,14 +67,14 @@ interface EventDispatcherInterface * @param string|array $eventName The event(s) to remove a listener from * @param callable $listener The listener to remove */ - function removeListener($eventName, $listener); + public function removeListener($eventName, $listener); /** * Removes an event subscriber. * * @param EventSubscriberInterface $subscriber The subscriber */ - function removeSubscriber(EventSubscriberInterface $subscriber); + public function removeSubscriber(EventSubscriberInterface $subscriber); /** * Gets the listeners of a specific event or all listeners. @@ -83,7 +83,7 @@ interface EventDispatcherInterface * * @return array The event listeners for the specified event, or all event listeners by event name */ - function getListeners($eventName = null); + public function getListeners($eventName = null); /** * Checks whether an event has any registered listeners. @@ -92,5 +92,5 @@ interface EventDispatcherInterface * * @return Boolean true if the specified event has any listeners, false otherwise */ - function hasListeners($eventName = null); + public function hasListeners($eventName = null); } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php index 1e85b98..080f892 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php @@ -46,5 +46,5 @@ interface EventSubscriberInterface * * @api */ - static function getSubscribedEvents(); + public static function getSubscribedEvents(); } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php new file mode 100644 index 0000000..b70b81a --- /dev/null +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ImmutableEventDispatcher.php @@ -0,0 +1,92 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\EventDispatcher; + +/** + * A read-only proxy for an event dispatcher. + * + * @author Bernhard Schussek + */ +class ImmutableEventDispatcher implements EventDispatcherInterface +{ + /** + * The proxied dispatcher. + * @var EventDispatcherInterface + */ + private $dispatcher; + + /** + * Creates an unmodifiable proxy for an event dispatcher. + * + * @param EventDispatcherInterface $dispatcher The proxied event dispatcher. + */ + public function __construct(EventDispatcherInterface $dispatcher) + { + $this->dispatcher = $dispatcher; + } + + /** + * {@inheritdoc} + */ + public function dispatch($eventName, Event $event = null) + { + return $this->dispatcher->dispatch($eventName, $event); + } + + /** + * {@inheritdoc} + */ + public function addListener($eventName, $listener, $priority = 0) + { + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); + } + + /** + * {@inheritdoc} + */ + public function addSubscriber(EventSubscriberInterface $subscriber) + { + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); + } + + /** + * {@inheritdoc} + */ + public function removeListener($eventName, $listener) + { + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); + } + + /** + * {@inheritdoc} + */ + public function removeSubscriber(EventSubscriberInterface $subscriber) + { + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); + } + + /** + * {@inheritdoc} + */ + public function getListeners($eventName = null) + { + return $this->dispatcher->getListeners($eventName); + } + + /** + * {@inheritdoc} + */ + public function hasListeners($eventName = null) + { + return $this->dispatcher->hasListeners($eventName); + } +} diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php index c62fc10..71f3ad0 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php @@ -235,14 +235,14 @@ class ContainerAwareEventDispatcherTest extends \PHPUnit_Framework_TestCase class Service { - function onEvent(Event $e) + public function onEvent(Event $e) { } } class SubscriberService implements EventSubscriberInterface { - static function getSubscribedEvents() + public static function getSubscribedEvents() { return array( 'onEvent' => 'onEvent', @@ -251,7 +251,7 @@ class SubscriberService implements EventSubscriberInterface ); } - function onEvent(Event $e) + public function onEvent(Event $e) { } } diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php index cbc3910..52aa9ad 100644 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php @@ -29,7 +29,6 @@ class EventTest extends \PHPUnit_Framework_TestCase */ protected $dispatcher; - /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php new file mode 100644 index 0000000..6402f89 --- /dev/null +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ImmutableEventDispatcherTest.php @@ -0,0 +1,106 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\EventDispatcher\Tests; + +use Symfony\Component\EventDispatcher\Event; +use Symfony\Component\EventDispatcher\ImmutableEventDispatcher; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; + +/** + * @author Bernhard Schussek + */ +class ImmutableEventDispatcherTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $innerDispatcher; + + /** + * @var ImmutableEventDispatcher + */ + private $dispatcher; + + protected function setUp() + { + $this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $this->dispatcher = new ImmutableEventDispatcher($this->innerDispatcher); + } + + public function testDispatchDelegates() + { + $event = new Event(); + + $this->innerDispatcher->expects($this->once()) + ->method('dispatch') + ->with('event', $event) + ->will($this->returnValue('result')); + + $this->assertSame('result', $this->dispatcher->dispatch('event', $event)); + } + + public function testGetListenersDelegates() + { + $this->innerDispatcher->expects($this->once()) + ->method('getListeners') + ->with('event') + ->will($this->returnValue('result')); + + $this->assertSame('result', $this->dispatcher->getListeners('event')); + } + + public function testHasListenersDelegates() + { + $this->innerDispatcher->expects($this->once()) + ->method('hasListeners') + ->with('event') + ->will($this->returnValue('result')); + + $this->assertSame('result', $this->dispatcher->hasListeners('event')); + } + + /** + * @expectedException \BadMethodCallException + */ + public function testAddListenerDisallowed() + { + $this->dispatcher->addListener('event', function () { return 'foo'; }); + } + + /** + * @expectedException \BadMethodCallException + */ + public function testAddSubscriberDisallowed() + { + $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface'); + + $this->dispatcher->addSubscriber($subscriber); + } + + /** + * @expectedException \BadMethodCallException + */ + public function testRemoveListenerDisallowed() + { + $this->dispatcher->removeListener('event', function () { return 'foo'; }); + } + + /** + * @expectedException \BadMethodCallException + */ + public function testRemoveSubscriberDisallowed() + { + $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface'); + + $this->dispatcher->removeSubscriber($subscriber); + } +} diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php deleted file mode 100644 index d2502b1..0000000 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher\Tests; - -use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\UnmodifiableEventDispatcher; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; - -/** - * @author Bernhard Schussek - */ -class UnmodifiableEventDispatcherTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $innerDispatcher; - - /** - * @var UnmodifiableEventDispatcher - */ - private $dispatcher; - - protected function setUp() - { - $this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $this->dispatcher = new UnmodifiableEventDispatcher($this->innerDispatcher); - } - - public function testDispatchDelegates() - { - $event = new Event(); - - $this->innerDispatcher->expects($this->once()) - ->method('dispatch') - ->with('event', $event) - ->will($this->returnValue('result')); - - $this->assertSame('result', $this->dispatcher->dispatch('event', $event)); - } - - public function testGetListenersDelegates() - { - $this->innerDispatcher->expects($this->once()) - ->method('getListeners') - ->with('event') - ->will($this->returnValue('result')); - - $this->assertSame('result', $this->dispatcher->getListeners('event')); - } - - public function testHasListenersDelegates() - { - $this->innerDispatcher->expects($this->once()) - ->method('hasListeners') - ->with('event') - ->will($this->returnValue('result')); - - $this->assertSame('result', $this->dispatcher->hasListeners('event')); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testAddListenerDisallowed() - { - $this->dispatcher->addListener('event', function () { return 'foo'; }); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testAddSubscriberDisallowed() - { - $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface'); - - $this->dispatcher->addSubscriber($subscriber); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testRemoveListenerDisallowed() - { - $this->dispatcher->removeListener('event', function () { return 'foo'; }); - } - - /** - * @expectedException \BadMethodCallException - */ - public function testRemoveSubscriberDisallowed() - { - $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface'); - - $this->dispatcher->removeSubscriber($subscriber); - } -} diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php deleted file mode 100644 index c7097aa..0000000 --- a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php +++ /dev/null @@ -1,92 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\EventDispatcher; - -/** - * A read-only proxy for an event dispatcher. - * - * @author Bernhard Schussek - */ -class UnmodifiableEventDispatcher implements EventDispatcherInterface -{ - /** - * The proxied dispatcher. - * @var EventDispatcherInterface - */ - private $dispatcher; - - /** - * Creates an unmodifiable proxy for an event dispatcher. - * - * @param EventDispatcherInterface $dispatcher The proxied event dispatcher. - */ - public function __construct(EventDispatcherInterface $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - /** - * {@inheritdoc} - */ - public function dispatch($eventName, Event $event = null) - { - return $this->dispatcher->dispatch($eventName, $event); - } - - /** - * {@inheritdoc} - */ - public function addListener($eventName, $listener, $priority = 0) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function removeListener($eventName, $listener) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function removeSubscriber(EventSubscriberInterface $subscriber) - { - throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); - } - - /** - * {@inheritdoc} - */ - public function getListeners($eventName = null) - { - return $this->dispatcher->getListeners($eventName); - } - - /** - * {@inheritdoc} - */ - public function hasListeners($eventName = null) - { - return $this->dispatcher->hasListeners($eventName); - } -} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md index d8664e6..4a00207 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.1.0 ----- + * added Request::getSchemeAndHttpHost() and Request::getUserInfo() * added a fluent interface to the Response class * added Request::isProxyTrusted() * added JsonResponse @@ -21,7 +22,8 @@ CHANGELOG * [BC BREAK] Moved all session related classes and interfaces into own namespace, as `Symfony\Component\HttpFoundation\Session` and renamed classes accordingly. Session handlers are located in the subnamespace `Symfony\Component\HttpFoundation\Session\Handler`. - * SessionHandlers must implement `\SessionHandlerInterface`. + * SessionHandlers must implement `\SessionHandlerInterface` or extend from the + `Symfony\Component\HttpFoundation\Storage\Handler\NativeSessionHandler` base class. * Added internal storage driver proxy mechanism for forward compatibility with PHP 5.4 `\SessionHandler` class. * Added session handlers for custom Memcache, Memcached and Null session save handlers. @@ -52,8 +54,8 @@ CHANGELOG * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This implementation is ESI compatible. * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire - behaviour of messages auto expiring. - after one page page load. Messages must be retrieved by `get()` or `all()`. + behaviour of messages auto expiring after one page page load. Messages must + be retrieved by `get()` or `all()`. * Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate attributes storage behaviour from 2.0.x (default). * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php index 47c2199..fe3a4cf 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php @@ -72,6 +72,11 @@ class Cookie $this->httpOnly = (Boolean) $httpOnly; } + /** + * Returns the cookie as a string. + * + * @return string The cookie + */ public function __toString() { $str = urlencode($this->getName()).'='; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php index dcea613..d5715f6 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php @@ -30,12 +30,14 @@ class ExtensionGuesser implements ExtensionGuesserInterface { /** * The singleton instance + * * @var ExtensionGuesser */ - static private $instance = null; + private static $instance = null; /** * All registered ExtensionGuesserInterface instances + * * @var array */ protected $guessers = array(); @@ -45,7 +47,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * * @return ExtensionGuesser */ - static public function getInstance() + public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); @@ -83,7 +85,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * value. * * @param string $mimeType The mime type - * @return string The guessed extension or NULL, if none could be guessed + * @return string The guessed extension or NULL, if none could be guessed */ public function guess($mimeType) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php index e8db065..8373696 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php @@ -20,7 +20,7 @@ interface ExtensionGuesserInterface * Makes a best guess for a file extension, given a mime type * * @param string $mimeType The mime type - * @return string The guessed extension or NULL, if none could be guessed + * @return string The guessed extension or NULL, if none could be guessed */ - function guess($mimeType); + public function guess($mimeType); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index 0761c26..3da63dd 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -43,15 +43,13 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface * * @return Boolean */ - static public function isSupported() + public static function isSupported() { return !defined('PHP_WINDOWS_VERSION_BUILD'); } /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() + * {@inheritdoc} */ public function guess($path) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php index 873b94b..09a0d7e 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -26,15 +26,13 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface * * @return Boolean */ - static public function isSupported() + public static function isSupported() { return function_exists('finfo_open'); } /** - * Guesses the mime type of the file with the given path - * - * @see MimeTypeGuesserInterface::guess() + * {@inheritdoc} */ public function guess($path) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php index 805f223..13fe4a2 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\File\Mimetype; +namespace Symfony\Component\HttpFoundation\File\MimeType; /** * Provides a best-guess mapping of mime type to file extension. @@ -542,6 +542,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'application/x-pkcs7-certificates' => 'p7b', 'application/x-pkcs7-certreqresp' => 'p7r', 'application/x-rar-compressed' => 'rar', + 'application/x-rar' => 'rar', 'application/x-sh' => 'sh', 'application/x-shar' => 'shar', 'application/x-shockwave-flash' => 'swf', @@ -730,11 +731,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface ); /** - * Returns the extension based on the mime type. - * - * If the mime type is unknown, returns null. - * - * @return string|null The guessed extension or null if it cannot be guessed + * {@inheritdoc} */ public function guess($mimeType) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index 84bd4ce..a8247ab 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -11,6 +11,7 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; +use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; @@ -34,12 +35,14 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface { /** * The singleton instance + * * @var MimeTypeGuesser */ - static private $instance = null; + private static $instance = null; /** * All registered MimeTypeGuesserInterface instances + * * @var array */ protected $guessers = array(); @@ -49,7 +52,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * * @return MimeTypeGuesser */ - static public function getInstance() + public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php index 40e8ffd..87ea20f 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php @@ -11,6 +11,9 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; +use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; + /** * Guesses the mime type of a file * @@ -28,5 +31,5 @@ interface MimeTypeGuesserInterface * @throws FileNotFoundException If the file does not exist * @throws AccessDeniedException If the file could not be read */ - function guess($path); + public function guess($path); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php index 7e57b02..6d6dda1 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -199,9 +199,9 @@ class UploadedFile extends File /** * Returns the maximum size of an uploaded file as configured in php.ini * - * @return type The maximum size of an uploaded file in bytes + * @return int The maximum size of an uploaded file in bytes */ - static public function getMaxFilesize() + public static function getMaxFilesize() { $max = trim(ini_get('upload_max_filesize')); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php index 0f85eb0..b2775ef 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php @@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; */ class FileBag extends ParameterBag { - static private $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); + private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); /** * Constructor. @@ -38,8 +38,7 @@ class FileBag extends ParameterBag } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::replace() + * {@inheritdoc} * * @api */ @@ -50,23 +49,21 @@ class FileBag extends ParameterBag } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::set() + * {@inheritdoc} * * @api */ public function set($key, $value) { - if (is_array($value) || $value instanceof UploadedFile) { - parent::set($key, $this->convertFileInformation($value)); - } else { + if (!is_array($value) && !$value instanceof UploadedFile) { throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); } + + parent::set($key, $this->convertFileInformation($value)); } /** - * (non-PHPdoc) - * @see Symfony\Component\HttpFoundation\ParameterBag::add() + * {@inheritdoc} * * @api */ diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php index 734628f..43ade8f 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php @@ -38,7 +38,7 @@ class JsonResponse extends Response /** * {@inheritDoc} */ - static public function create($data = array(), $status = 200, $headers = array()) + public static function create($data = array(), $status = 200, $headers = array()) { return new static($data, $status, $headers); } @@ -52,7 +52,7 @@ class JsonResponse extends Response */ public function setCallback($callback = null) { - if ($callback) { + if (null !== $callback) { // taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u'; $parts = explode('.', $callback); @@ -95,7 +95,7 @@ class JsonResponse extends Response */ protected function update() { - if ($this->callback) { + if (null !== $this->callback) { // Not using application/javascript for compatibility reasons with older browsers. $this->headers->set('Content-Type', 'text/javascript', true); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php index a39756e..0273d93 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php @@ -94,6 +94,8 @@ class ParameterBag implements \IteratorAggregate, \Countable * @param mixed $default The default value if the parameter key does not exist * @param boolean $deep If true, a path like foo[bar] will find deeper items * + * @return mixed + * * @api */ public function get($path, $default = null, $deep = false) diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php index 27676ec..f2e854e 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -66,7 +66,7 @@ class RedirectResponse extends Response /** * {@inheritDoc} */ - static public function create($url = '', $status = 302, $headers = array()) + public static function create($url = '', $status = 302, $headers = array()) { return new static($url, $status, $headers); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php index 581b4c9..8d681a9 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php @@ -30,7 +30,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; */ class Request { - static protected $trustProxy = false; + protected static $trustProxy = false; /** * @var \Symfony\Component\HttpFoundation\ParameterBag @@ -87,17 +87,17 @@ class Request protected $content; /** - * @var string + * @var array */ protected $languages; /** - * @var string + * @var array */ protected $charsets; /** - * @var string + * @var array */ protected $acceptableContentTypes; @@ -147,9 +147,9 @@ class Request protected $defaultLocale = 'en'; /** - * @var string + * @var array */ - static protected $formats; + protected static $formats; /** * Constructor. @@ -213,7 +213,7 @@ class Request * * @api */ - static public function createFromGlobals() + public static function createFromGlobals() { $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); @@ -232,7 +232,7 @@ class Request * * @param string $uri The URI * @param string $method The HTTP method - * @param array $parameters The request (GET) or query (POST) parameters + * @param array $parameters The query (GET) or request (POST) parameters * @param array $cookies The request cookies ($_COOKIE) * @param array $files The request files ($_FILES) * @param array $server The server parameters ($_SERVER) @@ -242,7 +242,7 @@ class Request * * @api */ - static public function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) + public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) { $defaults = array( 'SERVER_NAME' => 'localhost', @@ -305,15 +305,12 @@ class Request } if (isset($components['query'])) { - $queryString = html_entity_decode($components['query']); - parse_str($queryString, $qs); - if (is_array($qs)) { - $query = array_replace($qs, $query); - } + parse_str(html_entity_decode($components['query']), $qs); + $query = array_replace($qs, $query); } - $queryString = http_build_query($query); + $queryString = http_build_query($query, '', '&'); - $uri = $components['path'].($queryString ? '?'.$queryString : ''); + $uri = $components['path'].('' !== $queryString ? '?'.$queryString : ''); $server = array_replace($defaults, $server, array( 'REQUEST_METHOD' => strtoupper($method), @@ -335,6 +332,8 @@ class Request * @param array $files The FILES parameters * @param array $server The SERVER parameters * + * @return Request The duplicated request + * * @api */ public function duplicate(array $query = null, array $request = null, array $attributes = null, array $cookies = null, array $files = null, array $server = null) @@ -405,7 +404,8 @@ class Request /** * Overrides the PHP global variables according to this request instance. * - * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE, and $_FILES. + * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE. + * $_FILES is never override, see rfc1867 * * @api */ @@ -415,7 +415,6 @@ class Request $_POST = $this->request->all(); $_SERVER = $this->server->all(); $_COOKIE = $this->cookies->all(); - // FIXME: populate $_FILES foreach ($this->headers->all() as $key => $value) { $key = strtoupper(str_replace('-', '_', $key)); @@ -426,9 +425,15 @@ class Request } } - // FIXME: should read variables_order and request_order - // to know which globals to merge and in which order - $_REQUEST = array_merge($_GET, $_POST); + $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE); + + $requestOrder = ini_get('request_order') ?: ini_get('variable_order'); + $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp'; + + $_REQUEST = array(); + foreach (str_split($requestOrder) as $order) { + $_REQUEST = array_merge($_REQUEST, $request[$order]); + } } /** @@ -439,7 +444,7 @@ class Request * * @api */ - static public function trustProxyData() + public static function trustProxyData() { self::$trustProxy = true; } @@ -450,12 +455,55 @@ class Request * * @return boolean */ - static public function isProxyTrusted() + public static function isProxyTrusted() { return self::$trustProxy; } /** + * Normalizes a query string. + * + * It builds a normalized query string, where keys/value pairs are alphabetized, + * have consistent escaping and unneeded delimiters are removed. + * + * @param string $qs Query string + * + * @return string A normalized query string for the Request + */ + public static function normalizeQueryString($qs) + { + if ('' == $qs) { + return ''; + } + + $parts = array(); + $order = array(); + + foreach (explode('&', $qs) as $param) { + if ('' === $param || '=' === $param[0]) { + // Ignore useless delimiters, e.g. "x=y&". + // Also ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. + // PHP also does not include them when building _GET. + continue; + } + + $keyValuePair = explode('=', $param, 2); + + // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). + // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. This is why we use urldecode and then normalize to + // RFC 3986 with rawurlencode. + $parts[] = isset($keyValuePair[1]) ? + rawurlencode(urldecode($keyValuePair[0])).'='.rawurlencode(urldecode($keyValuePair[1])) : + rawurlencode(urldecode($keyValuePair[0])); + $order[] = urldecode($keyValuePair[0]); + } + + array_multisort($order, SORT_ASC, $parts); + + return implode('&', $parts); + } + + /** * Gets a "parameter" value. * * This method is mainly useful for libraries that want to provide some flexibility. @@ -470,9 +518,9 @@ class Request * It is better to explicity get request parameters from the appropriate * public property instead (query, request, attributes, ...). * - * @param string $key the key - * @param mixed $default the default value - * @param type $deep is parameter deep in multidimensional array + * @param string $key the key + * @param mixed $default the default value + * @param Boolean $deep is parameter deep in multidimensional array * * @return mixed */ @@ -504,9 +552,7 @@ class Request public function hasPreviousSession() { // the check for $this->session avoids malicious users trying to fake a session cookie with proper name - $sessionName = $this->hasSession() ? $this->session->getName() : null; - - return $this->cookies->has($sessionName) && $this->hasSession(); + return $this->hasSession() && $this->cookies->has($this->session->getName()); } /** @@ -555,6 +601,7 @@ class Request return $cleanIpAddress; } } + return ''; } } @@ -692,6 +739,23 @@ class Request } /** + * Gets the user info. + * + * @return string A user name and, optionally, scheme-specific information about how to gain authorization to access the server + */ + public function getUserInfo() + { + $userinfo = $this->getUser(); + + $pass = $this->getPassword(); + if ('' != $pass) { + $userinfo .= ":$pass"; + } + + return $userinfo; + } + + /** * Returns the HTTP host being requested. * * The port name will be appended to the host if it's non-standard. @@ -729,6 +793,16 @@ class Request } /** + * Gets the scheme and HTTP host. + * + * @return string The scheme and HTTP host + */ + public function getSchemeAndHttpHost() + { + return $this->getScheme().'://'.(('' != $auth = $this->getUserInfo()) ? $auth.'@' : '').$this->getHttpHost(); + } + + /** * Generates a normalized URI for the Request. * * @return string A normalized URI for the Request @@ -744,20 +818,7 @@ class Request $qs = '?'.$qs; } - $auth = ''; - if ($user = $this->getUser()) { - $auth = $user; - } - - if ($pass = $this->getPassword()) { - $auth .= ":$pass"; - } - - if ('' !== $auth) { - $auth .= '@'; - } - - return $this->getScheme().'://'.$auth.$this->getHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; + return $this->getSchemeAndHttpHost().$this->getBaseUrl().$this->getPathInfo().$qs; } /** @@ -771,7 +832,7 @@ class Request */ public function getUriForPath($path) { - return $this->getScheme().'://'.$this->getHttpHost().$this->getBaseUrl().$path; + return $this->getSchemeAndHttpHost().$this->getBaseUrl().$path; } /** @@ -786,26 +847,9 @@ class Request */ public function getQueryString() { - if (!$qs = $this->server->get('QUERY_STRING')) { - return null; - } - - $parts = array(); - $order = array(); - - foreach (explode('&', $qs) as $segment) { - if (false === strpos($segment, '=')) { - $parts[] = $segment; - $order[] = $segment; - } else { - $tmp = explode('=', rawurldecode($segment), 2); - $parts[] = rawurlencode($tmp[0]).'='.rawurlencode($tmp[1]); - $order[] = $tmp[0]; - } - } - array_multisort($order, SORT_ASC, $parts); + $qs = static::normalizeQueryString($this->server->get('QUERY_STRING')); - return implode('&', $parts); + return '' === $qs ? null : $qs; } /** @@ -881,7 +925,7 @@ class Request if (null === $this->method) { $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); if ('POST' === $this->method) { - $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', 'POST'))); + $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', $this->query->get('_method', 'POST')))); } } @@ -911,7 +955,7 @@ class Request * * @param string $mimeType The associated mime type * - * @return string The format (null if not found) + * @return string|null The format (null if not found) * * @api */ @@ -990,7 +1034,7 @@ class Request /** * Gets the format associated with the request. * - * @return string The format (null if no content type is present) + * @return string|null The format (null if no content type is present) * * @api */ @@ -1093,6 +1137,9 @@ class Request return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, PREG_SPLIT_NO_EMPTY); } + /** + * @return Boolean + */ public function isNoCache() { return $this->headers->hasCacheControlDirective('no-cache') || 'no-cache' == $this->headers->get('Pragma'); @@ -1268,14 +1315,14 @@ class Request } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); // HTTP proxy reqs setup request uri with scheme and host [and port] + the url path, only use url path - $schemeAndHttpHost = $this->getScheme().'://'.$this->getHttpHost(); + $schemeAndHttpHost = $this->getSchemeAndHttpHost(); if (strpos($requestUri, $schemeAndHttpHost) === 0) { $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); } } elseif ($this->server->has('ORIG_PATH_INFO')) { // IIS 5.0, PHP as CGI $requestUri = $this->server->get('ORIG_PATH_INFO'); - if ($this->server->get('QUERY_STRING')) { + if ('' != $this->server->get('QUERY_STRING')) { $requestUri .= '?'.$this->server->get('QUERY_STRING'); } } @@ -1408,7 +1455,7 @@ class Request /** * Initializes HTTP request formats. */ - static protected function initializeFormats() + protected static function initializeFormats() { static::$formats = array( 'html' => array('text/html', 'application/xhtml+xml'), diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php index 09c548c..072c520 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php @@ -31,7 +31,7 @@ class RequestMatcher implements RequestMatcherInterface private $host; /** - * @var string + * @var array */ private $methods; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php index 0ee161c..695fd21 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php @@ -29,5 +29,5 @@ interface RequestMatcherInterface * * @api */ - function matches(Request $request); + public function matches(Request $request); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php index 11fcf3b..1d2106e 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php @@ -36,7 +36,7 @@ interface SessionHandlerInterface * * @return boolean */ - function open($savePath, $sessionName); + public function open($savePath, $sessionName); /** * Close session. @@ -45,7 +45,7 @@ interface SessionHandlerInterface * * @return boolean */ - function close(); + public function close(); /** * Read session. @@ -56,7 +56,7 @@ interface SessionHandlerInterface * * @return string String as stored in persistent storage or empty string in all other cases. */ - function read($sessionId); + public function read($sessionId); /** * Commit session to storage. @@ -68,7 +68,7 @@ interface SessionHandlerInterface * * @return boolean */ - function write($sessionId, $data); + public function write($sessionId, $data); /** * Destroys this session. @@ -81,7 +81,7 @@ interface SessionHandlerInterface * * @return boolean */ - function destroy($sessionId); + public function destroy($sessionId); /** * Garbage collection for storage. @@ -94,5 +94,5 @@ interface SessionHandlerInterface * * @return boolean */ - function gc($lifetime); + public function gc($lifetime); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php index 882ac4d..7ab2014 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php @@ -61,7 +61,7 @@ class Response * * @var array */ - static public $statusTexts = array( + public static $statusTexts = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // RFC2518 @@ -158,7 +158,7 @@ class Response * * @return Response */ - static public function create($content = '', $status = 200, $headers = array()) + public static function create($content = '', $status = 200, $headers = array()) { return new static($content, $status, $headers); } @@ -299,6 +299,15 @@ class Response if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); + } elseif ('cli' !== PHP_SAPI) { + // ob_get_level() never returns 0 on some Windows configurations, so if + // the level is the same two times in a row, the loop should be stopped. + $previous = null; + while (($level = ob_get_level()) > 0 && $level !== $previous) { + $previous = $level; + ob_end_flush(); + } + flush(); } return $this; @@ -370,7 +379,10 @@ class Response * Sets the response status code. * * @param integer $code HTTP status code - * @param string $text HTTP status text + * @param mixed $text HTTP status text + * + * If the status text is null it will be automatically populated for the known + * status codes and left empty otherwise. * * @return Response * @@ -380,12 +392,24 @@ class Response */ public function setStatusCode($code, $text = null) { - $this->statusCode = (int) $code; + $this->statusCode = $code = (int) $code; if ($this->isInvalid()) { throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code)); } - $this->statusText = false === $text ? '' : (null === $text ? self::$statusTexts[$this->statusCode] : $text); + if (null === $text) { + $this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : ''; + + return $this; + } + + if (false === $text) { + $this->statusText = ''; + + return $this; + } + + $this->statusText = $text; return $this; } @@ -706,7 +730,7 @@ class Response * When the responses TTL is <= 0, the response may not be served from cache without first * revalidating with the origin. * - * @return integer The TTL in seconds + * @return integer|null The TTL in seconds * * @api */ @@ -965,6 +989,10 @@ class Response */ public function isNotModified(Request $request) { + if (!$request->isMethodSafe()) { + return false; + } + $lastModified = $request->headers->get('If-Modified-Since'); $notModified = false; if ($etags = $request->getEtags()) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 11615b9..c27d811 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -231,7 +231,7 @@ class ResponseHeaderBag extends HeaderBag throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); } - if (!$filenameFallback) { + if ('' == $filenameFallback) { $filenameFallback = $filename; } @@ -246,14 +246,14 @@ class ResponseHeaderBag extends HeaderBag } // path separators aren't allowed in either. - if (preg_match('#[/\\\\]#', $filename) || preg_match('#[/\\\\]#', $filenameFallback)) { + if (false !== strpos($filename, '/') || false !== strpos($filename, '\\') || false !== strpos($filenameFallback, '/') || false !== strpos($filenameFallback, '\\')) { throw new \InvalidArgumentException('The filename and the fallback cannot contain the "/" and "\\" characters.'); } - $output = sprintf('%s; filename="%s"', $disposition, str_replace(array('\\', '"'), array('\\\\', '\\"'), $filenameFallback)); + $output = sprintf('%s; filename="%s"', $disposition, str_replace('"', '\\"', $filenameFallback)); - if ($filename != $filenameFallback) { - $output .= sprintf("; filename*=utf-8''%s", str_replace(array("'", '(', ')', '*'), array('%27', '%28', '%29', '%2A'), urlencode($filename))); + if ($filename !== $filenameFallback) { + $output .= sprintf("; filename*=utf-8''%s", rawurlencode($filename)); } return $output; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php index ec6d93c..5f1f37b 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php @@ -27,7 +27,7 @@ interface AttributeBagInterface extends SessionBagInterface * * @return Boolean true if the attribute is defined, false otherwise */ - function has($name); + public function has($name); /** * Returns an attribute. @@ -37,7 +37,7 @@ interface AttributeBagInterface extends SessionBagInterface * * @return mixed */ - function get($name, $default = null); + public function get($name, $default = null); /** * Sets an attribute. @@ -45,21 +45,21 @@ interface AttributeBagInterface extends SessionBagInterface * @param string $name * @param mixed $value */ - function set($name, $value); + public function set($name, $value); /** * Returns attributes. * * @return array Attributes */ - function all(); + public function all(); /** * Sets attributes. * * @param array $attributes Attributes */ - function replace(array $attributes); + public function replace(array $attributes); /** * Removes an attribute. @@ -68,5 +68,5 @@ interface AttributeBagInterface extends SessionBagInterface * * @return mixed The removed value */ - function remove($name); + public function remove($name); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php index b47962f..c6e41de 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php @@ -93,7 +93,7 @@ class AutoExpireFlashBag implements FlashBagInterface */ public function peekAll() { - return array_key_exists('display', $this->flashes) ? (array)$this->flashes['display'] : array(); + return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); } /** @@ -139,7 +139,7 @@ class AutoExpireFlashBag implements FlashBagInterface */ public function set($type, $messages) { - $this->flashes['new'][$type] = (array)$messages; + $this->flashes['new'][$type] = (array) $messages; } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php index 2fab8bd..9ae5a3d 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php @@ -26,7 +26,7 @@ interface FlashBagInterface extends SessionBagInterface * @param string $type * @param string $message */ - function add($type, $message); + public function add($type, $message); /** * Registers a message for a given type. @@ -34,7 +34,7 @@ interface FlashBagInterface extends SessionBagInterface * @param string $type * @param string $message */ - function set($type, $message); + public function set($type, $message); /** * Gets flash message for a given type. @@ -44,14 +44,14 @@ interface FlashBagInterface extends SessionBagInterface * * @return string */ - function peek($type, array $default = array()); + public function peek($type, array $default = array()); /** * Gets all flash messages. * * @return array */ - function peekAll(); + public function peekAll(); /** * Gets and clears flash from the stack. @@ -61,19 +61,19 @@ interface FlashBagInterface extends SessionBagInterface * * @return string */ - function get($type, array $default = array()); + public function get($type, array $default = array()); /** * Gets and clears flashes from the stack. * * @return array */ - function all(); + public function all(); /** * Sets all flash messages. */ - function setAll(array $messages); + public function setAll(array $messages); /** * Has flash messages for a given type? @@ -82,12 +82,12 @@ interface FlashBagInterface extends SessionBagInterface * * @return boolean */ - function has($type); + public function has($type); /** * Returns a list of all defined types. * * @return array */ - function keys(); + public function keys(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php index b70a334..ee987c6 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php @@ -131,6 +131,14 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable } /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->storage->isStarted(); + } + + /** * Returns an iterator for attributes. * * @return \ArrayIterator An \ArrayIterator instance diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php index 50c2d4b..f8d3d32 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php @@ -23,26 +23,26 @@ interface SessionBagInterface * * @return string */ - function getName(); + public function getName(); /** * Initializes the Bag * * @param array $array */ - function initialize(array &$array); + public function initialize(array &$array); /** * Gets the storage key for this bag. * * @return string */ - function getStorageKey(); + public function getStorageKey(); /** * Clears out data from bag. * * @return mixed Whatever data was contained. */ - function clear(); + public function clear(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php index 833dd9c..a94fad0 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\HttpFoundation\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; + /** * Interface for the session. * @@ -27,7 +29,7 @@ interface SessionInterface * * @api */ - function start(); + public function start(); /** * Returns the session ID. @@ -36,7 +38,7 @@ interface SessionInterface * * @api */ - function getId(); + public function getId(); /** * Sets the session ID @@ -45,7 +47,7 @@ interface SessionInterface * * @api */ - function setId($id); + public function setId($id); /** * Returns the session name. @@ -54,7 +56,7 @@ interface SessionInterface * * @api */ - function getName(); + public function getName(); /** * Sets the session name. @@ -63,7 +65,7 @@ interface SessionInterface * * @api */ - function setName($name); + public function setName($name); /** * Invalidates the current session. @@ -80,7 +82,7 @@ interface SessionInterface * * @api */ - function invalidate($lifetime = null); + public function invalidate($lifetime = null); /** * Migrates the current session to a new session id while maintaining all @@ -96,7 +98,7 @@ interface SessionInterface * * @api */ - function migrate($destroy = false, $lifetime = null); + public function migrate($destroy = false, $lifetime = null); /** * Force the session to be saved and closed. @@ -105,7 +107,7 @@ interface SessionInterface * the session will be automatically saved at the end of * code execution. */ - function save(); + public function save(); /** * Checks if an attribute is defined. @@ -116,7 +118,7 @@ interface SessionInterface * * @api */ - function has($name); + public function has($name); /** * Returns an attribute. @@ -128,7 +130,7 @@ interface SessionInterface * * @api */ - function get($name, $default = null); + public function get($name, $default = null); /** * Sets an attribute. @@ -138,7 +140,7 @@ interface SessionInterface * * @api */ - function set($name, $value); + public function set($name, $value); /** * Returns attributes. @@ -147,14 +149,14 @@ interface SessionInterface * * @api */ - function all(); + public function all(); /** * Sets attributes. * * @param array $attributes Attributes */ - function replace(array $attributes); + public function replace(array $attributes); /** * Removes an attribute. @@ -165,21 +167,28 @@ interface SessionInterface * * @api */ - function remove($name); + public function remove($name); /** * Clears all attributes. * * @api */ - function clear(); + public function clear(); + + /** + * Checks if the session was started. + * + * @return Boolean + */ + public function isStarted(); /** * Registers a SessionBagInterface with the session. * * @param SessionBagInterface $bag */ - function registerBag(SessionBagInterface $bag); + public function registerBag(SessionBagInterface $bag); /** * Gets a bag instance by name. @@ -188,12 +197,12 @@ interface SessionInterface * * @return SessionBagInterface */ - function getBag($name); + public function getBag($name); /** * Gets session meta. * * @return MetadataBag */ - function getMetadataBag(); + public function getMetadataBag(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php deleted file mode 100644 index 1417b5a..0000000 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php +++ /dev/null @@ -1,115 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * FileSessionHandler. - * - * @author Drak - */ -class FileSessionHandler implements \SessionHandlerInterface -{ - /** - * @var string - */ - private $savePath; - - /** - * @var string - */ - private $prefix; - - /** - * Constructor. - * - * @param string $savePath Path of directory to save session files. - */ - public function __construct($savePath = null, $prefix = 'sess_') - { - if (null === $savePath) { - $savePath = sys_get_temp_dir(); - } - - $this->savePath = $savePath; - if (false === is_dir($this->savePath)) { - mkdir($this->savePath, 0777, true); - } - - $this->prefix = $prefix; - } - - /** - * {@inheritdoc] - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc] - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc] - */ - public function read($id) - { - $file = $this->getPath().$id; - - return is_readable($file) ? file_get_contents($file) : ''; - } - - /** - * {@inheritdoc] - */ - public function write($id, $data) - { - return false === file_put_contents($this->getPath().$id, $data) ? false : true; - } - - /** - * {@inheritdoc] - */ - public function destroy($id) - { - $file = $this->getPath().$id; - if (is_file($file)) { - unlink($file); - } - - return true; - } - - /** - * {@inheritdoc] - */ - public function gc($maxlifetime) - { - foreach (glob($this->getPath().'*') as $file) { - if ((filemtime($file) + $maxlifetime) < time()) { - unlink($file); - } - } - - return true; - } - - private function getPath() - { - return $this->savePath.'/'.$this->prefix; - } -} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index b666199..b3ca0bd 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -33,7 +33,6 @@ class MemcachedSessionHandler implements \SessionHandlerInterface */ private $ttl; - /** * @var string Key prefix for shared environments. */ diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php new file mode 100644 index 0000000..f39235c --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * NativeFileSessionHandler. + * + * Native session handler using PHP's built in file storage. + * + * @author Drak + */ +class NativeFileSessionHandler extends NativeSessionHandler +{ + /** + * Constructor. + * + * @param string $savePath Path of directory to save session files. + * Default null will leave setting as defined by PHP. + * '/path', 'N;/path', or 'N;octal-mode;/path + * + * @see http://php.net/session.configuration.php#ini.session.save-path for further details. + * + * @throws \InvalidArgumentException On invalid $savePath + */ + public function __construct($savePath = null) + { + if (null === $savePath) { + $savePath = ini_get('session.save_path'); + } + + $baseDir = $savePath; + + if ($count = substr_count($savePath, ';')) { + if ($count > 2) { + throw new \InvalidArgumentException(sprintf('Invalid argument $savePath \'%s\'', $savePath)); + } + + // characters after last ';' are the path + $baseDir = ltrim(strrchr($savePath, ';'), ';'); + } + + if ($baseDir && !is_dir($baseDir)) { + mkdir($baseDir, 0777, true); + } + + ini_set('session.save_path', $savePath); + ini_set('session.save_handler', 'files'); + } +} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php new file mode 100644 index 0000000..1260ad0 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * Adds SessionHandler functionality if available. + * + * @see http://php.net/sessionhandler + */ + +if (version_compare(phpversion(), '5.4.0', '>=')) { + class NativeSessionHandler extends \SessionHandler {} +} else { + class NativeSessionHandler {} +} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 4572552..b18d071 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -59,6 +59,11 @@ class MockArraySessionStorage implements SessionStorageInterface protected $metadataBag; /** + * @var array + */ + protected $bags; + + /** * Constructor. * * @param string $name Session name @@ -200,6 +205,14 @@ class MockArraySessionStorage implements SessionStorageInterface } /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->started; + } + + /** * Sets the MetadataBag. * * @param MetadataBag $bag diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php index 23b86b3..80aa44b 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php @@ -11,9 +11,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; - /** * MockFileSessionStorage is used to mock sessions for * functional testing when done in a single PHP process. @@ -28,27 +25,35 @@ use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; class MockFileSessionStorage extends MockArraySessionStorage { /** - * @var FileSessionHandler + * @var string + */ + private $savePath; + + /** + * @var array */ - private $handler; + private $sessionData; /** * Constructor. * - * @param string $savePath Path of directory to save session files. - * @param string $name Session name. - * @param FileSessionHandler $handler Save handler - * @param MetadataBag $metaData Metadatabag + * @param string $savePath Path of directory to save session files. + * @param string $name Session name. + * @param MetadataBag $metaBag MetadataBag instance. */ - public function __construct($savePath = null, $name = 'MOCKSESSID', FileSessionHandler $handler = null, MetadataBag $metaData = null) + public function __construct($savePath = null, $name = 'MOCKSESSID', MetadataBag $metaBag = null) { - if (null == $handler) { - $handler = new FileSessionHandler($savePath, 'mocksess_'); + if (null === $savePath) { + $savePath = sys_get_temp_dir(); } - $this->handler = $handler; + if (!is_dir($savePath)) { + mkdir($savePath, 0777, true); + } + + $this->savePath = $savePath; - parent::__construct($name, $metaData); + parent::__construct($name, $metaBag); } /** @@ -92,7 +97,7 @@ class MockFileSessionStorage extends MockArraySessionStorage */ public function save() { - $this->handler->write($this->id, serialize($this->data)); + file_put_contents($this->getFilePath(), serialize($this->data)); // this is needed for Silex, where the session object is re-used across requests // in functional tests. In Symfony, the container is rebooted, so we don't have @@ -106,7 +111,19 @@ class MockFileSessionStorage extends MockArraySessionStorage */ private function destroy() { - $this->handler->destroy($this->id); + if (is_file($this->getFilePath())) { + unlink($this->getFilePath()); + } + } + + /** + * Calculate path to file. + * + * @return string File path + */ + private function getFilePath() + { + return $this->savePath.'/'.$this->id.'.mocksess'; } /** @@ -114,8 +131,8 @@ class MockFileSessionStorage extends MockArraySessionStorage */ private function read() { - $data = $this->handler->read($this->id); - $this->data = $data ? unserialize($data) : array(); + $filePath = $this->getFilePath(); + $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); $this->loadSession(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 7a9d775..ec753ec 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -61,7 +61,9 @@ class NativeSessionStorage implements SessionStorageInterface * @see http://php.net/session.configuration for options * but we omit 'session.' from the beginning of the keys for convenience. * - * auto_start, "0" + * ("auto_start", is not supported as it tells PHP to start a session before + * PHP starts to execute user-land code. Setting during runtime has no effect). + * * cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely). * cookie_domain, "" * cookie_httponly, "" @@ -91,12 +93,10 @@ class NativeSessionStorage implements SessionStorageInterface * * @param array $options Session configuration options. * @param object $handler SessionHandlerInterface. - * @param MetadataBag $handler MetadataBag. + * @param MetadataBag $metaBag MetadataBag. */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) { - // sensible defaults - ini_set('session.auto_start', 0); // by default we prefer to explicitly start the session using the class. ini_set('session.cache_limiter', ''); // disable by default because it's managed by HeaderBag (if used) ini_set('session.use_cookies', 1); @@ -256,10 +256,10 @@ class NativeSessionStorage implements SessionStorageInterface throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); } - if (ini_get('session.auto_start') && !$this->started) { - $this->start(); - } elseif ($this->saveHandler->isActive() && !$this->started) { + if ($this->saveHandler->isActive() && !$this->started) { $this->loadSession(); + } elseif (!$this->started) { + $this->start(); } return $this->bags[$name]; @@ -290,6 +290,14 @@ class NativeSessionStorage implements SessionStorageInterface } /** + * {@inheritdoc} + */ + public function isStarted() + { + return $this->started; + } + + /** * Sets session.* ini variables. * * For convenience we omit 'session.' from the beginning of the keys. @@ -302,7 +310,7 @@ class NativeSessionStorage implements SessionStorageInterface public function setOptions(array $options) { $validOptions = array_flip(array( - 'auto_start', 'cache_limiter', 'cookie_domain', 'cookie_httponly', + 'cache_limiter', 'cookie_domain', 'cookie_httponly', 'cookie_lifetime', 'cookie_path', 'cookie_secure', 'entropy_file', 'entropy_length', 'gc_divisor', 'gc_maxlifetime', 'gc_probability', 'hash_bits_per_character', diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php index 09f9efa..0d4cb8b 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php @@ -58,7 +58,7 @@ abstract class AbstractProxy /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * - * @return bool + * @return Boolean */ public function isWrapper() { @@ -68,7 +68,7 @@ abstract class AbstractProxy /** * Has a session started? * - * @return bool + * @return Boolean */ public function isActive() { @@ -78,7 +78,7 @@ abstract class AbstractProxy /** * Sets the active flag. * - * @param bool $flag + * @param Boolean $flag */ public function setActive($flag) { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php index 5bb2c71..23eebb3 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php @@ -32,7 +32,7 @@ class NativeProxy extends AbstractProxy /** * Returns true if this handler wraps an internal PHP session save handler using \SessionHandler. * - * @return bool False. + * @return Boolean False. */ public function isWrapper() { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php index e925d62..e1f4fff 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -42,7 +42,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf */ public function open($savePath, $sessionName) { - $return = (bool)$this->handler->open($savePath, $sessionName); + $return = (bool) $this->handler->open($savePath, $sessionName); if (true === $return) { $this->active = true; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index c07ed7f..26a7418 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -33,7 +33,14 @@ interface SessionStorageInterface * * @api */ - function start(); + public function start(); + + /** + * Checks if the session is started. + * + * @return boolean True if started, false otherwise. + */ + public function isStarted(); /** * Returns the session ID @@ -42,7 +49,7 @@ interface SessionStorageInterface * * @api */ - function getId(); + public function getId(); /** * Sets the session ID @@ -51,7 +58,7 @@ interface SessionStorageInterface * * @api */ - function setId($id); + public function setId($id); /** * Returns the session name @@ -60,7 +67,7 @@ interface SessionStorageInterface * * @api */ - function getName(); + public function getName(); /** * Sets the session name @@ -69,7 +76,7 @@ interface SessionStorageInterface * * @api */ - function setName($name); + public function setName($name); /** * Regenerates id that represents this storage. @@ -94,7 +101,7 @@ interface SessionStorageInterface * * @api */ - function regenerate($destroy = false, $lifetime = null); + public function regenerate($destroy = false, $lifetime = null); /** * Force the session to be saved and closed. @@ -104,12 +111,12 @@ interface SessionStorageInterface * a real PHP session would interfere with testing, in which case it * it should actually persist the session data if required. */ - function save(); + public function save(); /** * Clear all session data in memory. */ - function clear(); + public function clear(); /** * Gets a SessionBagInterface by name. @@ -120,17 +127,17 @@ interface SessionStorageInterface * * @throws \InvalidArgumentException If the bag does not exist */ - function getBag($name); + public function getBag($name); /** * Registers a SessionBagInterface for use. * * @param SessionBagInterface $bag */ - function registerBag(SessionBagInterface $bag); + public function registerBag(SessionBagInterface $bag); /** * @return MetadataBag */ - function getMetadataBag(); + public function getMetadataBag(); } diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php index 599170f..414e578 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -72,7 +72,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} */ public function prepare(Request $request) { @@ -86,7 +86,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} * * This method only sends the content once. */ @@ -106,7 +106,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} * * @throws \LogicException when the content is not null */ @@ -118,7 +118,7 @@ class StreamedResponse extends Response } /** - * @{inheritdoc} + * {@inheritdoc} * * @return false */ diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php index f79096f..b42a3fc 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php @@ -132,7 +132,6 @@ class UploadedFileTest extends \PHPUnit_Framework_TestCase @unlink($targetPath); } - public function testGetClientOriginalNameSanitizeFilename() { $file = new UploadedFile( @@ -207,7 +206,6 @@ class UploadedFileTest extends \PHPUnit_Framework_TestCase $this->assertFalse($file->isValid()); } - public function uploadedFileErrorProvider() { return array( diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index d96e00b..c3c0b16 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -200,7 +200,6 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array'); - } /** diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php index 069d8b4..e165987 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php @@ -11,8 +11,6 @@ namespace Symfony\Component\HttpFoundation\Tests; - - use Symfony\Component\HttpFoundation\RequestMatcher; use Symfony\Component\HttpFoundation\Request; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 9d943ef..1e447c5 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpFoundation\Tests; - use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Request; @@ -336,7 +335,17 @@ class RequestTest extends \PHPUnit_Framework_TestCase 'http://hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri() ); - } + + // with user info + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); + + $server['PHP_AUTH_PW'] = 'symfony'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien:symfony@hostname:8080/ba%20se/index_dev.php/foo%20bar/in+fo?query=string', $request->getUri()); + } /** * @covers Symfony\Component\HttpFoundation\Request::getUriForPath @@ -436,35 +445,111 @@ class RequestTest extends \PHPUnit_Framework_TestCase $this->assertEquals('http://servername/some/path', $request->getUriForPath('/some/path'), '->getUriForPath() with rewrite, default port without HOST_HEADER'); $this->assertEquals('servername', $request->getHttpHost()); + + // with user info + + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@servername/some/path', $request->getUriForPath('/some/path')); + + $server['PHP_AUTH_PW'] = 'symfony'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien:symfony@servername/some/path', $request->getUriForPath('/some/path')); } /** - * @covers Symfony\Component\HttpFoundation\Request::getQueryString + * @covers Symfony\Component\HttpFoundation\Request::getUserInfo */ - public function testGetQueryString() + public function testGetUserInfo() { $request = new Request(); - $request->server->set('QUERY_STRING', 'foo'); - $this->assertEquals('foo', $request->getQueryString(), '->getQueryString() works with valueless parameters'); + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('fabien', $request->getUserInfo()); - $request->server->set('QUERY_STRING', 'foo='); - $this->assertEquals('foo=', $request->getQueryString(), '->getQueryString() includes a dangling equal sign'); + $server['PHP_AUTH_USER'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('0', $request->getUserInfo()); - $request->server->set('QUERY_STRING', 'bar=&foo=bar'); - $this->assertEquals('bar=&foo=bar', $request->getQueryString(), '->getQueryString() works when empty parameters'); + $server['PHP_AUTH_PW'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('0:0', $request->getUserInfo()); + } - $request->server->set('QUERY_STRING', 'foo=bar&bar='); - $this->assertEquals('bar=&foo=bar', $request->getQueryString(), '->getQueryString() sorts keys alphabetically'); + /** + * @covers Symfony\Component\HttpFoundation\Request::getSchemeAndHttpHost + */ + public function testGetSchemeAndHttpHost() + { + $request = new Request(); - $request->server->set('QUERY_STRING', 'him=John%20Doe&her=Jane+Doe'); - $this->assertEquals('her=Jane%2BDoe&him=John%20Doe', $request->getQueryString(), '->getQueryString() normalizes encoding'); + $server['SERVER_NAME'] = 'servername'; + $server['SERVER_PORT'] = '90'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://servername:90', $request->getSchemeAndHttpHost()); - $request->server->set('QUERY_STRING', 'foo[]=1&foo[]=2'); - $this->assertEquals('foo%5B%5D=1&foo%5B%5D=2', $request->getQueryString(), '->getQueryString() allows array notation'); + $server['PHP_AUTH_USER'] = 'fabien'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://fabien@servername:90', $request->getSchemeAndHttpHost()); - $request->server->set('QUERY_STRING', 'foo=1&foo=2'); - $this->assertEquals('foo=1&foo=2', $request->getQueryString(), '->getQueryString() allows repeated parameters'); + $server['PHP_AUTH_USER'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://0@servername:90', $request->getSchemeAndHttpHost()); + + $server['PHP_AUTH_PW'] = '0'; + $request->initialize(array(), array(), array(), array(), array(), $server); + $this->assertEquals('http://0:0@servername:90', $request->getSchemeAndHttpHost()); + } + + /** + * @covers Symfony\Component\HttpFoundation\Request::getQueryString + * @covers Symfony\Component\HttpFoundation\Request::normalizeQueryString + * @dataProvider getQueryStringNormalizationData + */ + public function testGetQueryString($query, $expectedQuery, $msg) + { + $request = new Request(); + + $request->server->set('QUERY_STRING', $query); + $this->assertSame($expectedQuery, $request->getQueryString(), $msg); + } + + public function getQueryStringNormalizationData() + { + return array( + array('foo', 'foo', 'works with valueless parameters'), + array('foo=', 'foo=', 'includes a dangling equal sign'), + array('bar=&foo=bar', 'bar=&foo=bar', '->works with empty parameters'), + array('foo=bar&bar=', 'bar=&foo=bar', 'sorts keys alphabetically'), + + // GET parameters, that are submitted from a HTML form, encode spaces as "+" by default (as defined in enctype application/x-www-form-urlencoded). + // PHP also converts "+" to spaces when filling the global _GET or when using the function parse_str. + array('him=John%20Doe&her=Jane+Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes spaces in both encodings "%20" and "+"'), + + array('foo[]=1&foo[]=2', 'foo%5B%5D=1&foo%5B%5D=2', 'allows array notation'), + array('foo=1&foo=2', 'foo=1&foo=2', 'allows repeated parameters'), + array('pa%3Dram=foo%26bar%3Dbaz&test=test', 'pa%3Dram=foo%26bar%3Dbaz&test=test', 'works with encoded delimiters'), + array('0', '0', 'allows "0"'), + array('Jane Doe&John%20Doe', 'Jane%20Doe&John%20Doe', 'normalizes encoding in keys'), + array('her=Jane Doe&him=John%20Doe', 'her=Jane%20Doe&him=John%20Doe', 'normalizes encoding in values'), + array('foo=bar&&&test&&', 'foo=bar&test', 'removes unneeded delimiters'), + array('formula=e=m*c^2', 'formula=e%3Dm%2Ac%5E2', 'correctly treats only the first "=" as delimiter and the next as value'), + + // Ignore pairs with empty key, even if there was a value, e.g. "=value", as such nameless values cannot be retrieved anyway. + // PHP also does not include them when building _GET. + array('foo=bar&=a=b&=x=y', 'foo=bar', 'removes params with empty key'), + ); + } + + public function testGetQueryStringReturnsNull() + { + $request = new Request(); + + $this->assertNull($request->getQueryString(), '->getQueryString() returns null for non-existent query string'); + + $request->server->set('QUERY_STRING', ''); + $this->assertNull($request->getQueryString(), '->getQueryString() returns null for empty query string'); } /** @@ -536,6 +621,11 @@ class RequestTest extends \PHPUnit_Framework_TestCase $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); $request->setMethod('POST'); + $request->request->remove('_method'); + $request->query->set('_method', 'purge'); + $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); + + $request->setMethod('POST'); $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override even though _method is set if defined and POST'); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 4edcd6d..cbbdd29 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -367,6 +367,33 @@ class ResponseTest extends \PHPUnit_Framework_TestCase $this->assertFalse($response->isInvalid()); } + /** + * @dataProvider getStatusCodeFixtures + */ + public function testSetStatusCode($code, $text, $expectedText) + { + $response = new Response(); + + $response->setStatusCode($code, $text); + + $statusText = new \ReflectionProperty($response, 'statusText'); + $statusText->setAccessible(true); + + $this->assertEquals($expectedText, $statusText->getValue($response)); + } + + public function getStatusCodeFixtures() + { + return array( + array('200', null, 'OK'), + array('200', false, ''), + array('200', 'foo', 'foo'), + array('199', null, ''), + array('199', false, ''), + array('199', 'foo', 'foo') + ); + } + public function testIsInformational() { $response = new Response('', 100); diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 2f2b26f..7bdc127 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpFoundation\Tests\Session; use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\MetadataBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; @@ -260,7 +259,7 @@ class SessionTest extends \PHPUnit_Framework_TestCase } /** - * @covers Symfony\Component\HttpFoundation\Session\Session::count + * @covers \Symfony\Component\HttpFoundation\Session\Session::count */ public function testGetCount() { diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php deleted file mode 100644 index d935b34..0000000 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; - -/** - * Test class for FileSessionHandler. - * - * @author Drak - */ -class FileSessionStorageTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var FileSessionHandler - */ - private $handler; - - /** - * @var string - */ - private $path; - - public function setUp() - { - $this->path = sys_get_temp_dir().'/filesessionhandler'; - $this->handler = new FileSessionHandler($this->path, 'mocksess_'); - - parent::setUp(); - } - - public function tearDown() - { - foreach (glob($this->path.'/*') as $file) { - unlink($file); - } - - rmdir($this->path); - - $this->handler = null; - } - - public function test__construct() - { - $this->assertTrue(is_dir($this->path)); - } - - public function testOpen() - { - $this->assertTrue($this->handler->open('a', 'b')); - } - - public function testClose() - { - $this->assertTrue($this->handler->close()); - } - - public function testReadWrite() - { - $this->assertEmpty($this->handler->read('123')); - $this->assertTrue($this->handler->write('123', 'data')); - $this->assertEquals('data', $this->handler->read('123')); - } - - public function testDestroy() - { - $this->handler->write('456', 'data'); - $this->handler->destroy('123'); - $this->assertEquals('data', $this->handler->read('456')); - $this->handler->destroy('456'); - $this->assertEmpty($this->handler->read('456')); - } - - public function testGc() - { - $prefix = $this->path.'/mocksess_'; - $this->handler->write('1', 'data'); - touch($prefix.'1', time()-86400); - - $this->handler->write('2', 'data'); - touch($prefix.'2', time()-3600); - - $this->handler->write('3', 'data'); - touch($prefix.'3', time()-300); - - $this->handler->write('4', 'data'); - - $this->handler->gc(90000); - $this->assertEquals(4, count(glob($this->path.'/*'))); - - $this->handler->gc(4000); - $this->assertEquals(3, count(glob($this->path.'/*'))); - - $this->handler->gc(200); - $this->assertEquals(1, count(glob($this->path.'/*'))); - } -} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php new file mode 100644 index 0000000..fdb0b99 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; + +/** + * Test class for NativeFileSessionHandler. + * + * @author Drak + * + * @runTestsInSeparateProcesses + */ +class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + public function test__Construct() + { + $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); + + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); + $this->assertEquals('files', ini_get('session.save_handler')); + } else { + $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); + $this->assertEquals('user', ini_get('session.save_handler')); + } + + $this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path')); + $this->assertEquals('TESTING', ini_get('session.name')); + } + + /** + * @dataProvider savePathDataProvider + */ + public function test__ConstructSavePath($savePath, $expectedSavePath, $path) + { + $handler = new NativeFileSessionHandler($savePath); + $this->assertEquals($expectedSavePath, ini_get('session.save_path')); + $dir = realpath('/'.$path); + $this->assertTrue(is_dir(realpath($dir))); + + rmdir($dir); + } + + public function savePathDataProvider() + { + $base = sys_get_temp_dir(); + return array( + array("$base/foo", "$base/foo", "$base/foo"), + array("5;$base/foo", "5;$base/foo", "$base/foo"), + array("5;0600;$base/foo", "5;0600;$base/foo", "$base/foo"), + ); + } + + /** + * @expectedException \InvalidArgumentException + */ + public function test__ConstructException() + { + $handler = new NativeFileSessionHandler('something;invalid;with;too-many-args'); + } + + public function testConstructDefault() + { + $path = ini_get('session.save_path'); + $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler()); + + $this->assertEquals($path, ini_get('session.save_path')); + } +} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php new file mode 100644 index 0000000..7880615 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; + +/** + * Test class for NativeSessionHandler. + * + * @author Drak + * + * @runTestsInSeparateProcesses + */ +class NativeSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + public function testConstruct() + { + $handler = new NativeSessionHandler(); + + // note for PHPUnit optimisers - the use of assertTrue/False + // here is deliberate since the tests do not require the classes to exist - drak + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertFalse($handler instanceof \SessionHandler); + $this->assertTrue($handler instanceof NativeSessionHandler); + } else { + $this->assertTrue($handler instanceof \SessionHandler); + $this->assertTrue($handler instanceof NativeSessionHandler); + } + } +} diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php index 3bd702e..45a47ce 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php @@ -55,4 +55,3 @@ class NullSessionStorageTest extends \PHPUnit_Framework_TestCase return new NativeSessionStorage(array(), new NullSessionHandler()); } } - diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index d0938e0..ff1565a 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -61,4 +61,3 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(0, count($this->pdo->query('SELECT * FROM sessions')->fetchAll())); } } - diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php index 0da4805..c9b2a74 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -28,12 +28,12 @@ class MockArraySessionStorageTest extends \PHPUnit_Framework_TestCase private $storage; /** - * @var array + * @var AttributeBag */ private $attributes; /** - * @var array + * @var FlashBag */ private $flashes; diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php index 7bfe6a7..f18089d 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -28,7 +28,7 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase private $sessionDir; /** - * @var MockFileSessionStorage + * @var FileMockSessionStorage */ protected $storage; @@ -40,14 +40,12 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase protected function tearDown() { - foreach (glob($this->sessionDir.'/mocksess_*') as $file) { - unlink($file); - } - - rmdir($this->sessionDir); - $this->sessionDir = null; $this->storage = null; + array_map('unlink', glob($this->sessionDir.'/*.session')); + if (is_dir($this->sessionDir)) { + rmdir($this->sessionDir); + } } public function testStart() diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 528a1d7..4b88a23 100644 --- a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; @@ -136,8 +137,8 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } - ini_set('session.save_handler', 'files'); $storage = $this->getStorage(); + $storage->setSaveHandler(new NativeFileSessionHandler()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 980b890..3203d84 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -29,14 +29,14 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function boot(); + public function boot(); /** * Shutdowns the Bundle. * * @api */ - function shutdown(); + public function shutdown(); /** * Builds the bundle. @@ -47,7 +47,7 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function build(ContainerBuilder $container); + public function build(ContainerBuilder $container); /** * Returns the container extension that should be implicitly loaded. @@ -56,16 +56,20 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getContainerExtension(); + public function getContainerExtension(); /** - * Returns the bundle parent name. + * Returns the bundle name that this bundle overrides. * - * @return string The Bundle parent name it overrides or null if no parent + * Despite its name, this method does not imply any parent/child relationship + * between the bundles, just a way to extend and override an existing + * bundle. + * + * @return string The Bundle name it overrides or null if no parent * * @api */ - function getParent(); + public function getParent(); /** * Returns the bundle name (the class short name). @@ -74,7 +78,7 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getName(); + public function getName(); /** * Gets the Bundle namespace. @@ -83,7 +87,7 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getNamespace(); + public function getNamespace(); /** * Gets the Bundle directory path. @@ -94,5 +98,5 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getPath(); + public function getPath(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md index d061c7d..c27de87 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md @@ -4,6 +4,8 @@ CHANGELOG 2.1.0 ----- + * [BC BREAK] the charset is now configured via the Kernel::getCharset() method + * [BC BREAK] the current locale for the user is not stored anymore in the session * added the HTTP method to the profiler storage * updated all listeners to implement EventSubscriberInterface * added TimeDataCollector diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php index 1588b67..d4a2db3 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php @@ -23,5 +23,5 @@ interface CacheClearerInterface * * @param string $cacheDir The cache directory. */ - function clear($cacheDir); + public function clear($cacheDir); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php index 478cdc9..ed76ce3 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php @@ -28,5 +28,5 @@ interface CacheWarmerInterface extends WarmableInterface * * @return Boolean true if the warmer is optional, false otherwise */ - function isOptional(); + public function isOptional(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php index 0476161..25d8ee8 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php @@ -23,5 +23,5 @@ interface WarmableInterface * * @param string $cacheDir The cache directory */ - function warmUp($cacheDir); + public function warmUp($cacheDir); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php index 986a13d..f58f50d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php @@ -45,7 +45,7 @@ interface ControllerResolverInterface * * @api */ - function getController(Request $request); + public function getController(Request $request); /** * Returns the arguments to pass to the controller. @@ -59,5 +59,5 @@ interface ControllerResolverInterface * * @api */ - function getArguments(Request $request, $controller); + public function getArguments(Request $request, $controller); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index 37e93b0..81ede39 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -31,7 +31,7 @@ class ConfigDataCollector extends DataCollector * * @param KernelInterface $kernel A KernelInterface instance */ - public function __construct(KernelInterface $kernel) + public function setKernel(KernelInterface $kernel) { $this->kernel = $kernel; } @@ -44,9 +44,9 @@ class ConfigDataCollector extends DataCollector $this->data = array( 'token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, - 'name' => $this->kernel->getName(), - 'env' => $this->kernel->getEnvironment(), - 'debug' => $this->kernel->isDebug(), + 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', + 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', + 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, 'xdebug_enabled' => extension_loaded('xdebug'), 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), @@ -55,8 +55,10 @@ class ConfigDataCollector extends DataCollector 'bundles' => array(), ); - foreach ($this->kernel->getBundles() as $name => $bundle) { - $this->data['bundles'][$name] = $bundle->getPath(); + if (isset($this->kernel)) { + foreach ($this->kernel->getBundles() as $name => $bundle) { + $this->data['bundles'][$name] = $bundle->getPath(); + } } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index 7da36b6..98eabdb 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\DataCollector; - /** * DataCollector. * diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php index 7cfbbd1..cf4cdfd 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php @@ -32,7 +32,7 @@ interface DataCollectorInterface * * @api */ - function collect(Request $request, Response $response, \Exception $exception = null); + public function collect(Request $request, Response $response, \Exception $exception = null); /** * Returns the name of the collector. @@ -41,5 +41,5 @@ interface DataCollectorInterface * * @api */ - function getName(); + public function getName(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php index d6808ce..20ff597 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php @@ -29,13 +29,8 @@ class ExceptionDataCollector extends DataCollector public function collect(Request $request, Response $response, \Exception $exception = null) { if (null !== $exception) { - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - } - $this->data = array( - 'exception' => $flattenException, + 'exception' => FlattenException::create($exception), ); } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index f7cf88e..b410c23 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -17,14 +17,24 @@ use Symfony\Component\HttpFoundation\HeaderBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\ResponseHeaderBag; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * RequestDataCollector. * * @author Fabien Potencier */ -class RequestDataCollector extends DataCollector +class RequestDataCollector extends DataCollector implements EventSubscriberInterface { + protected $controllers; + + public function __construct() + { + $this->controllers = new \SplObjectStorage(); + } + /** * {@inheritdoc} */ @@ -60,11 +70,17 @@ class RequestDataCollector extends DataCollector } $sessionMetadata = array(); - + $sessionAttributes = array(); + $flashes = array(); if ($request->hasSession()) { - $sessionMetadata['Created'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getCreated()); - $sessionMetadata['Last used'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getLastUsed()); - $sessionMetadata['Lifetime'] = $request->getSession()->getMetadataBag()->getLifetime(); + $session = $request->getSession(); + if ($session->isStarted()) { + $sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated()); + $sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed()); + $sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime(); + $sessionAttributes = $session->all(); + $flashes = $session->getFlashBag()->peekAll(); + } } $this->data = array( @@ -80,10 +96,29 @@ class RequestDataCollector extends DataCollector 'request_attributes' => $attributes, 'response_headers' => $responseHeaders, 'session_metadata' => $sessionMetadata, - 'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(), - 'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(), + 'session_attributes' => $sessionAttributes, + 'flashes' => $flashes, 'path_info' => $request->getPathInfo(), + 'controller' => 'n/a', ); + + if (isset($this->controllers[$request])) { + $controller = $this->controllers[$request]; + if (is_array($controller)) { + $r = new \ReflectionMethod($controller[0], $controller[1]); + $this->data['controller'] = array( + 'class' => get_class($controller[0]), + 'method' => $controller[1], + 'file' => $r->getFilename(), + 'line' => $r->getStartLine(), + ); + } elseif ($controller instanceof \Closure) { + $this->data['controller'] = 'Closure'; + } else { + $this->data['controller'] = (string) $controller ?: 'n/a'; + } + unset($this->controllers[$request]); + } } public function getPathInfo() @@ -162,6 +197,50 @@ class RequestDataCollector extends DataCollector } /** + * Gets the route name. + * + * The _route request attributes is automatically set by the Router Matcher. + * + * @return string The route + */ + public function getRoute() + { + return isset($this->data['request_attributes']['_route']) ? $this->data['request_attributes']['_route'] : ''; + } + + /** + * Gets the route parameters. + * + * The _route_params request attributes is automatically set by the RouterListener. + * + * @return array The parameters + */ + public function getRouteParams() + { + return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params'] : array(); + } + + /** + * Gets the controller. + * + * @return string The controller as a string + */ + public function getController() + { + return $this->data['controller']; + } + + public function onKernelController(FilterControllerEvent $event) + { + $this->controllers[$event->getRequest()] = $event->getController(); + } + + public static function getSubscribedEvents() + { + return array(KernelEvents::CONTROLLER => 'onKernelController'); + } + + /** * {@inheritdoc} */ public function getName() diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php new file mode 100644 index 0000000..07b2780 --- /dev/null +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\DataCollector; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; + +/** + * RouterDataCollector. + * + * @author Fabien Potencier + */ +class RouterDataCollector extends DataCollector +{ + protected $controllers; + + public function __construct() + { + $this->controllers = new \SplObjectStorage(); + + $this->data = array( + 'redirect' => false, + 'url' => null, + 'route' => null, + ); + } + + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Exception $exception = null) + { + if ($response instanceof RedirectResponse) { + $this->data['redirect'] = true; + $this->data['url'] = $response->getTargetUrl(); + + if ($this->controllers->contains($request)) { + $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]); + } + } + } + + protected function guessRoute(Request $request, $controller) + { + return 'n/a'; + } + + /** + * Remembers the controller associated to each request. + * + * @param FilterControllerEvent The filter controller event + */ + public function onKernelController(FilterControllerEvent $event) + { + $this->controllers[$event->getRequest()] = $event->getController(); + } + + /** + * @return Boolean Whether this request will result in a redirect + */ + public function getRedirect() + { + return $this->data['redirect']; + } + + /** + * @return string|null The target URL + */ + public function getTargetUrl() + { + return $this->data['url']; + } + + /** + * @return string|null The target route + */ + public function getTargetRoute() + { + return $this->data['route']; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'router'; + } +} diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php index a91e91c..0d5ac81 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php @@ -74,7 +74,7 @@ class TimeDataCollector extends DataCollector { $lastEvent = $this->data['events']['__section__']; - return $lastEvent->getOrigin() + $lastEvent->getTotalTime() - $this->data['start_time']; + return $lastEvent->getOrigin() + $lastEvent->getTotalTime() - $this->getStartTime(); } /** diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php index a2466d6..605c086 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php @@ -39,7 +39,7 @@ class ErrorHandler * * @return The registered error handler */ - static public function register($level = null) + public static function register($level = null) { $handler = new static(); $handler->setLevel($level); @@ -64,7 +64,7 @@ class ErrorHandler } if (error_reporting() & $level && $this->level & $level) { - throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line)); + throw new \ErrorException(sprintf('%s: %s in %s line %d', isset($this->levels[$level]) ? $this->levels[$level] : $level, $message, $file, $line), 0, $level, $file, $line); } return false; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php index a9da249..848f3cc 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php @@ -45,7 +45,7 @@ class ExceptionHandler * * @return The registered exception handler */ - static public function register($debug = true) + public static function register($debug = true) { $handler = new static($debug); @@ -100,7 +100,7 @@ class ExceptionHandler } } - return new Response($this->decorate($content, $title), $exception->getStatusCode()); + return new Response($this->decorate($content, $title), $exception->getStatusCode(), $exception->getHeaders()); } private function getContent($exception) diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php index 8388ccf..7e036fd 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php @@ -30,7 +30,7 @@ abstract class ConfigurableExtension extends Extension /** * {@inheritDoc} */ - public final function load(array $configs, ContainerBuilder $container) + final public function load(array $configs, ContainerBuilder $container) { $this->loadInternal($this->processConfiguration($this->getConfiguration(array(), $container), $configs), $container); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php index dacd60a..5c8d5e6 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php @@ -96,7 +96,7 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn return Container::underscore($classBaseName); } - protected final function processConfiguration(ConfigurationInterface $configuration, array $configs) + final protected function processConfiguration(ConfigurationInterface $configuration, array $configs) { $processor = new Processor(); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php index ba67dc1..1176a73 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php @@ -51,7 +51,7 @@ class EsiListener implements EventSubscriberInterface $this->esi->addSurrogateControl($event->getResponse()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => 'onKernelResponse', diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index c7a90e4..99c9fff 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -62,15 +62,9 @@ class ExceptionListener implements EventSubscriberInterface $logger = $this->logger instanceof DebugLoggerInterface ? $this->logger : null; - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - $flattenException->setHeaders($exception->getHeaders()); - } - $attributes = array( '_controller' => $this->controller, - 'exception' => $flattenException, + 'exception' => FlattenException::create($exception), 'logger' => $logger, 'format' => $request->getRequestFormat(), ); @@ -96,7 +90,7 @@ class ExceptionListener implements EventSubscriberInterface $handling = false; // re-throw the exception as this is a catch-all - throw $exception; + return; } $event->setResponse($response); @@ -104,7 +98,7 @@ class ExceptionListener implements EventSubscriberInterface $handling = false; } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::EXCEPTION => array('onKernelException', -128), diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php index cfe9734..529314b 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php @@ -36,18 +36,10 @@ class LocaleListener implements EventSubscriberInterface { $request = $event->getRequest(); - if ($request->hasPreviousSession()) { - $request->setDefaultLocale($request->getSession()->get('_locale', $this->defaultLocale)); - } else { - $request->setDefaultLocale($this->defaultLocale); - } + $request->setDefaultLocale($this->defaultLocale); if ($locale = $request->attributes->get('_locale')) { $request->setLocale($locale); - - if ($request->hasPreviousSession()) { - $request->getSession()->set('_locale', $request->getLocale()); - } } if (null !== $this->router) { @@ -55,7 +47,7 @@ class LocaleListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( // must be registered after the Router to have access to the _locale diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php index 83ee82a..5b2228b 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php @@ -117,9 +117,13 @@ class ProfilerListener implements EventSubscriberInterface array_pop($this->requests); $parent = end($this->requests); - $profiles = isset($this->children[$parent]) ? $this->children[$parent] : array(); - $profiles[] = $profile; - $this->children[$parent] = $profiles; + + // when simulating requests, we might not have the parent + if ($parent) { + $profiles = isset($this->children[$parent]) ? $this->children[$parent] : array(); + $profiles[] = $profile; + $this->children[$parent] = $profiles; + } } if (isset($this->children[$request])) { @@ -134,7 +138,7 @@ class ProfilerListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( // kernel.request must be registered as early as possible to not break diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php index d047b1f..669980c 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php @@ -50,7 +50,7 @@ class ResponseListener implements EventSubscriberInterface $response->prepare($event->getRequest()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => 'onKernelResponse', diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php index be43a72..6cccd37 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\HttpKernel\Log\LoggerInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; @@ -21,25 +20,40 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Initializes request attributes based on a matching route. + * Initializes the context from the request and sets request attributes based on a matching route. * * @author Fabien Potencier */ class RouterListener implements EventSubscriberInterface { private $matcher; + private $context; private $logger; - public function __construct($matcher, LoggerInterface $logger = null) + /** + * Constructor. + * + * @param UrlMatcherInterface|RequestMatcherInterface $matcher The Url or Request matcher + * @param RequestContext|null $context The RequestContext (can be null when $matcher implements RequestContextAwareInterface) + * @param LoggerInterface|null $logger The logger + */ + public function __construct($matcher, RequestContext $context = null, LoggerInterface $logger = null) { if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) { throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); } + if (null === $context && !$matcher instanceof RequestContextAwareInterface) { + throw new \InvalidArgumentException('You must either pass a RequestContext or the matcher must implement RequestContextAwareInterface.'); + } + $this->matcher = $matcher; + $this->context = $context ?: $matcher->getContext(); $this->logger = $logger; } @@ -47,18 +61,17 @@ class RouterListener implements EventSubscriberInterface { $request = $event->getRequest(); - if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->matcher->getContext()->fromRequest($request); - } + // initialize the context that is also used by the generator (assuming matcher and generator share the same context instance) + $this->context->fromRequest($request); if ($request->attributes->has('_controller')) { // routing is already done return; } - // add attributes based on the path info (routing) + // add attributes based on the request (routing) try { - // matching requests is more powerful than matching URLs only, so try that first + // matching a request is more powerful than matching a URL path + context, so try that first if ($this->matcher instanceof RequestMatcherInterface) { $parameters = $this->matcher->matchRequest($request); } else { @@ -94,7 +107,7 @@ class RouterListener implements EventSubscriberInterface return implode(', ', $pieces); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array(array('onKernelRequest', 32)), diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php index 588c5fe..88505fa 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php @@ -43,7 +43,7 @@ class StreamedResponseListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => array('onKernelResponse', -1024), diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php index 16f1453..b2ffb9f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php @@ -30,14 +30,19 @@ class FlattenException private $file; private $line; - static public function create(\Exception $exception, $statusCode = null, array $headers = array()) + public static function create(\Exception $exception, $statusCode = null, array $headers = array()) { $e = new static(); $e->setMessage($exception->getMessage()); $e->setCode($exception->getCode()); + if ($exception instanceof HttpExceptionInterface) { + $statusCode = $exception->getStatusCode(); + $headers = array_merge($headers, $exception->getHeaders()); + } + if (null === $statusCode) { - $statusCode = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; + $statusCode = 500; } $e->setStatusCode($statusCode); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php index 11102bd..dd4a9dc 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php @@ -23,12 +23,12 @@ interface HttpExceptionInterface * * @return integer An HTTP response status code */ - function getStatusCode(); + public function getStatusCode(); /** * Returns response headers. * * @return array Response headers */ - function getHeaders(); + public function getHeaders(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php index 7b1d387..0fb8a12 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php @@ -30,12 +30,12 @@ interface EsiResponseCacheStrategyInterface * * @param Response $response */ - function add(Response $response); + public function add(Response $response); /** * Updates the Response HTTP headers based on the embedded Responses. * * @param Response $response */ - function update(Response $response); + public function update(Response $response); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php index 58f8a8c..dd8c886 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php @@ -31,7 +31,7 @@ interface StoreInterface * * @return Response|null A Response instance, or null if no cache entry was found */ - function lookup(Request $request); + public function lookup(Request $request); /** * Writes a cache entry to the store for the given Request and Response. @@ -44,14 +44,14 @@ interface StoreInterface * * @return string The key under which the response is stored */ - function write(Request $request, Response $response); + public function write(Request $request, Response $response); /** * Invalidates all cache entries that match the request. * * @param Request $request A Request instance */ - function invalidate(Request $request); + public function invalidate(Request $request); /** * Locks the cache for a given Request. @@ -60,14 +60,14 @@ interface StoreInterface * * @return Boolean|string true if the lock is acquired, the path to the current lock otherwise */ - function lock(Request $request); + public function lock(Request $request); /** * Releases the lock for the given Request. * * @param Request $request A Request instance */ - function unlock(Request $request); + public function unlock(Request $request); /** * Purges data for the given URL. @@ -76,10 +76,10 @@ interface StoreInterface * * @return Boolean true if the URL exists and has been purged, false otherwise */ - function purge($url); + public function purge($url); /** * Cleanups storage. */ - function cleanup(); + public function cleanup(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php index eea71e8..12ebed3 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -184,14 +185,30 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface $event = new GetResponseForExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); + // a listener might have replaced the exception + $e = $event->getException(); + if (!$event->hasResponse()) { throw $e; } + $response = $event->getResponse(); + + // ensure that we actually have an error response + if (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { + if ($e instanceof HttpExceptionInterface) { + // keep the HTTP status code and headers + $response->setStatusCode($e->getStatusCode()); + $response->headers->add($e->getHeaders()); + } else { + $response->setStatusCode(500); + } + } + try { - return $this->filterResponse($event->getResponse(), $request, $type); + return $this->filterResponse($response, $request, $type); } catch (\Exception $e) { - return $event->getResponse(); + return $response; } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php index efcf39d..f49d37c 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php @@ -43,5 +43,5 @@ interface HttpKernelInterface * * @api */ - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php index bc45891..0f9cadb 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php @@ -58,7 +58,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.1.0-BETA1'; + const VERSION = '2.1.0-BETA4'; const VERSION_ID = '20100'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '1'; @@ -79,7 +79,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface $this->debug = (Boolean) $debug; $this->booted = false; $this->rootDir = $this->getRootDir(); - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + $this->name = $this->getName(); $this->classes = array(); if ($this->debug) { @@ -354,6 +354,10 @@ abstract class Kernel implements KernelInterface, TerminableInterface */ public function getName() { + if (null === $this->name) { + $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + } + return $this->name; } @@ -468,6 +472,18 @@ abstract class Kernel implements KernelInterface, TerminableInterface } /** + * Gets the charset of the application. + * + * @return string The charset + * + * @api + */ + public function getCharset() + { + return 'UTF-8'; + } + + /** * Initializes the data structures related to the bundle management. * * - the bundles property maps a bundle name to the bundle instance, @@ -601,7 +617,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface 'kernel.cache_dir' => $this->getCacheDir(), 'kernel.logs_dir' => $this->getLogDir(), 'kernel.bundles' => $bundles, - 'kernel.charset' => 'UTF-8', + 'kernel.charset' => $this->getCharset(), 'kernel.container_class' => $this->getContainerClass(), ), $this->getEnvParameters() @@ -736,7 +752,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface * * @return string The PHP string with the comments removed */ - static public function stripComments($source) + public static function stripComments($source) { if (!function_exists('token_get_all')) { return $source; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php index 4fb0abc..4010a30 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php @@ -34,7 +34,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function registerBundles(); + public function registerBundles(); /** * Loads the container configuration @@ -43,14 +43,14 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function registerContainerConfiguration(LoaderInterface $loader); + public function registerContainerConfiguration(LoaderInterface $loader); /** * Boots the current kernel. * * @api */ - function boot(); + public function boot(); /** * Shutdowns the kernel. @@ -59,7 +59,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function shutdown(); + public function shutdown(); /** * Gets the registered bundle instances. @@ -68,7 +68,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getBundles(); + public function getBundles(); /** * Checks if a given class name belongs to an active bundle. @@ -79,7 +79,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function isClassInActiveBundle($class); + public function isClassInActiveBundle($class); /** * Returns a bundle and optionally its descendants by its name. @@ -93,7 +93,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getBundle($name, $first = true); + public function getBundle($name, $first = true); /** * Returns the file path for a given resource. @@ -123,7 +123,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function locateResource($name, $dir = null, $first = true); + public function locateResource($name, $dir = null, $first = true); /** * Gets the name of the kernel @@ -132,7 +132,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getName(); + public function getName(); /** * Gets the environment. @@ -141,7 +141,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getEnvironment(); + public function getEnvironment(); /** * Checks if debug mode is enabled. @@ -150,7 +150,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function isDebug(); + public function isDebug(); /** * Gets the application root dir. @@ -159,7 +159,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getRootDir(); + public function getRootDir(); /** * Gets the current container. @@ -168,7 +168,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getContainer(); + public function getContainer(); /** * Gets the request start time (not available if debug is disabled). @@ -177,7 +177,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getStartTime(); + public function getStartTime(); /** * Gets the cache directory. @@ -186,7 +186,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getCacheDir(); + public function getCacheDir(); /** * Gets the log directory. @@ -195,5 +195,14 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getLogDir(); + public function getLogDir(); + + /** + * Gets the charset of the application. + * + * @return string The charset + * + * @api + */ + public function getCharset(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php index 65bb25a..4442c63 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php @@ -27,12 +27,12 @@ interface DebugLoggerInterface * * @return array An array of logs */ - function getLogs(); + public function getLogs(); /** * Returns the number of errors. * * @return integer The number of errors */ - function countErrors(); + public function countErrors(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php index 97fe65b..34847c8 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php @@ -23,40 +23,40 @@ interface LoggerInterface /** * @api */ - function emerg($message, array $context = array()); + public function emerg($message, array $context = array()); /** * @api */ - function alert($message, array $context = array()); + public function alert($message, array $context = array()); /** * @api */ - function crit($message, array $context = array()); + public function crit($message, array $context = array()); /** * @api */ - function err($message, array $context = array()); + public function err($message, array $context = array()); /** * @api */ - function warn($message, array $context = array()); + public function warn($message, array $context = array()); /** * @api */ - function notice($message, array $context = array()); + public function notice($message, array $context = array()); /** * @api */ - function info($message, array $context = array()); + public function info($message, array $context = array()); /** * @api */ - function debug($message, array $context = array()); + public function debug($message, array $context = array()); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php index ebf1912..c4e259a 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php @@ -153,20 +153,27 @@ abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface 'time' => $profile->getTime(), ); + $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); + if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime)) { - // Add to index - $indexName = $this->getIndexName(); - - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - ))."\n"; - - return $this->appendValue($indexName, $indexRow, $this->lifetime); + + if (!$profileIndexed) { + // Add to index + $indexName = $this->getIndexName(); + + $indexRow = implode("\t", array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + ))."\n"; + + return $this->appendValue($indexName, $indexRow, $this->lifetime); + } + + return true; } return false; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php index 7f85cde..dfab9a6 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php @@ -129,10 +129,13 @@ class FileProfilerStorage implements ProfilerStorageInterface { $file = $this->getFilename($profile->getToken()); - // Create directory - $dir = dirname($file); - if (!is_dir($dir)) { - mkdir($dir, 0777, true); + $profileIndexed = is_file($file); + if (!$profileIndexed) { + // Create directory + $dir = dirname($file); + if (!is_dir($dir)) { + mkdir($dir, 0777, true); + } } // Store profile @@ -151,20 +154,22 @@ class FileProfilerStorage implements ProfilerStorageInterface return false; } - // Add to index - if (false === $file = fopen($this->getIndexFilename(), 'a')) { - return false; - } + if (!$profileIndexed) { + // Add to index + if (false === $file = fopen($this->getIndexFilename(), 'a')) { + return false; + } - fputcsv($file, array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - )); - fclose($file); + fputcsv($file, array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + )); + fclose($file); + } return true; } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php index 0ddac78..0dcad22 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php @@ -114,7 +114,7 @@ class MongoDbProfilerStorage implements ProfilerStorageInterface { if ($this->mongo === null) { if (preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $this->dsn, $matches)) { - $mongo = new \Mongo($matches[1]); + $mongo = new \Mongo($matches[1] . (!empty($matches[2]) ? '/' . $matches[2] : '')); $database = $matches[2]; $collection = $matches[3]; $this->mongo = $mongo->selectCollection($database, $collection); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php index 4091232..b7bc617 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php @@ -235,7 +235,7 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface return $profiles; } - + /** * Returns whether data for the given token already exists in storage. * diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php index db608ea..f92d90d 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php @@ -28,7 +28,7 @@ interface ProfilerStorageInterface * * @return array An array of tokens */ - function find($ip, $url, $limit, $method); + public function find($ip, $url, $limit, $method); /** * Reads data associated with the given token. @@ -39,7 +39,7 @@ interface ProfilerStorageInterface * * @return Profile The profile associated with token */ - function read($token); + public function read($token); /** * Saves a Profile. @@ -48,10 +48,10 @@ interface ProfilerStorageInterface * * @return Boolean Write operation successful */ - function write(Profile $profile); + public function write(Profile $profile); /** * Purges all data from the database. */ - function purge(); + public function purge(); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php index f7e5f3c..ec8ad1f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php @@ -167,20 +167,27 @@ class RedisProfilerStorage implements ProfilerStorageInterface 'time' => $profile->getTime(), ); + $profileIndexed = false !== $this->getValue($this->getItemName($profile->getToken())); + if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime, self::REDIS_SERIALIZER_PHP)) { - // Add to index - $indexName = $this->getIndexName(); - - $indexRow = implode("\t", array( - $profile->getToken(), - $profile->getIp(), - $profile->getMethod(), - $profile->getUrl(), - $profile->getTime(), - $profile->getParentToken(), - ))."\n"; - - return $this->appendValue($indexName, $indexRow, $this->lifetime); + + if (!$profileIndexed) { + // Add to index + $indexName = $this->getIndexName(); + + $indexRow = implode("\t", array( + $profile->getToken(), + $profile->getIp(), + $profile->getMethod(), + $profile->getUrl(), + $profile->getTime(), + $profile->getParentToken(), + ))."\n"; + + return $this->appendValue($indexName, $indexRow, $this->lifetime); + } + + return true; } return false; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php index 70e9c50..f59bbc9 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\Profiler; - /** * SqliteProfilerStorage stores profiling information in a SQLite database. * diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php index 78a362f..fc0e580 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php @@ -35,5 +35,5 @@ interface TerminableInterface * * @api */ - function terminate(Request $request, Response $response); + public function terminate(Request $request, Response $response); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php index eaff42a..8affb5f 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php @@ -25,7 +25,7 @@ class BundleTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('The "Console" component is not available'); } - if (!class_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { + if (!interface_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { $this->markTestSkipped('The "DependencyInjection" component is not available'); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php index e1ede85..594af32 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php @@ -162,7 +162,7 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase { } - static protected function controllerMethod4() + protected static function controllerMethod4() { } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index 407f18f..f517c12 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -28,8 +28,9 @@ class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase public function testCollect() { - $kernel = new KernelForTest('test',true); - $c = new ConfigDataCollector($kernel); + $kernel = new KernelForTest('test', true); + $c = new ConfigDataCollector(); + $c->setKernel($kernel); $c->collect(new Request(), new Response()); $this->assertSame('test',$c->getEnv()); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php index b126848..40c54e5 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php @@ -71,9 +71,9 @@ class ContainerAwareTraceableEventDispatcherTest extends \PHPUnit_Framework_Test class StaticClassFixture { - static public $called = false; + public static $called = false; - static public function staticListener($event) + public static function staticListener($event) { self::$called = true; } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php index 585efd4..0eb2d79 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php @@ -51,6 +51,9 @@ class ErrorHandlerTest extends \PHPUnit_Framework_TestCase $handler->handle(1, 'foo', 'foo.php', 12, 'foo'); } catch (\ErrorException $e) { $this->assertSame('1: foo in foo.php line 12', $e->getMessage()); + $this->assertSame(1, $e->getSeverity()); + $this->assertSame('foo.php', $e->getFile()); + $this->assertSame(12, $e->getLine()); } restore_error_handler(); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php index 8c61f5a..c13e559 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel\Tests\Debug; use Symfony\Component\HttpKernel\Debug\ExceptionHandler; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase { @@ -51,6 +52,15 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertContains('Sorry, the page you are looking for could not be found.', $response->getContent()); } + public function testHeaders() + { + $handler = new ExceptionHandler(false); + + $response = $handler->createResponse(new MethodNotAllowedHttpException(array('POST'))); + $this->assertEquals('405', $response->getStatusCode()); + $this->assertEquals('POST', $response->headers->get('Allow')); + } + public function testNestedExceptions() { $handler = new ExceptionHandler(true); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php index 76ae556..210acb5 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php @@ -85,7 +85,6 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase $stopwatch->stop('foobar'); $stopwatch->stopSection('0'); - // the section is an event by itself $this->assertCount(3, $stopwatch->getSectionEvents('1')); $this->assertCount(2, $stopwatch->getSectionEvents('2')); diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php index a13b325..9ca6432 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php @@ -34,23 +34,6 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $this->assertEquals('fr', $request->getLocale()); } - public function testDefaultLocaleWithSession() - { - $request = Request::create('/'); - session_name('foo'); - $request->cookies->set('foo', 'value'); - - $session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session', array('get'), array(), '', true); - $session->expects($this->once())->method('get')->will($this->returnValue('es')); - $request->setSession($session); - - $listener = new LocaleListener('fr'); - $event = $this->getEvent($request); - - $listener->onKernelRequest($event); - $this->assertEquals('es', $request->getLocale()); - } - public function testLocaleFromRequestAttribute() { $request = Request::create('/'); @@ -61,12 +44,6 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase $listener = new LocaleListener('fr'); $event = $this->getEvent($request); - // also updates the session _locale value - $session = $this->getMock('Symfony\Component\HttpFoundation\Session\Session', array('set', 'get'), array(), '', true); - $session->expects($this->once())->method('set')->with('_locale', 'es'); - $session->expects($this->once())->method('get')->with('_locale')->will($this->returnValue('es')); - $request->setSession($session); - $listener->onKernelRequest($event); $this->assertEquals('es', $request->getLocale()); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index 9ac028c..3ba56a8 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -92,18 +92,43 @@ class RouterListenerTest extends \PHPUnit_Framework_TestCase $request = Request::create('http://localhost/'); $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); - $context = new RequestContext(); + $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface'); + $requestMatcher->expects($this->once()) + ->method('matchRequest') + ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) + ->will($this->returnValue(array())); + + $listener = new RouterListener($requestMatcher, new RequestContext()); + $listener->onKernelRequest($event); + } + + public function testSubRequestWithDifferentMethod() + { + $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = Request::create('http://localhost/', 'post'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface'); $requestMatcher->expects($this->any()) - ->method('getContext') - ->will($this->returnValue($context)); - $requestMatcher->expects($this->once()) ->method('matchRequest') ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) ->will($this->returnValue(array())); - $listener = new RouterListener($requestMatcher); + $context = new RequestContext(); + $requestMatcher->expects($this->any()) + ->method('getContext') + ->will($this->returnValue($context)); + + $listener = new RouterListener($requestMatcher, new RequestContext()); + $listener->onKernelRequest($event); + + // sub-request with another HTTP method + $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = Request::create('http://localhost/', 'get'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST); + $listener->onKernelRequest($event); + + $this->assertEquals('GET', $context->getMethod()); } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php index a1ddda7..65975aa 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel\Tests\Exception; use Symfony\Component\HttpKernel\Exception\FlattenException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; class FlattenExceptionTest extends \PHPUnit_Framework_TestCase { @@ -28,6 +29,12 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('404', $flattened->getStatusCode()); } + public function testHeadersForHttpException() + { + $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); + $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders()); + } + /** * @dataProvider flattenDataProvider */ diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php new file mode 100644 index 0000000..32c05f4 --- /dev/null +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\Fixtures; + +use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\Config\Loader\LoaderInterface; + +class KernelForOverrideName extends Kernel +{ + protected $name = 'overridden'; + + public function registerBundles() + { + + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { + + } +} diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php index f277378..da7ef5b 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php @@ -16,12 +16,12 @@ use Symfony\Component\EventDispatcher\EventDispatcher; class TestEventDispatcher extends EventDispatcher implements TraceableEventDispatcherInterface { - function getCalledListeners() + public function getCalledListeners() { return array('foo'); } - function getNotCalledListeners() + public function getNotCalledListeners() { return array('bar'); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index 3d78c7c..4377f61 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php @@ -154,7 +154,7 @@ class HttpCacheTestCase extends \PHPUnit_Framework_TestCase $this->catch = $catch; } - static public function clearDirectory($directory) + public static function clearDirectory($directory) { if (!is_dir($directory)) { return; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php index bdbc4e8..e1e1701 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php @@ -14,8 +14,11 @@ namespace Symfony\Component\HttpKernel\Tests; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\EventDispatcher\EventDispatcher; class HttpKernelTest extends \PHPUnit_Framework_TestCase @@ -59,8 +62,38 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase }); $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); })); + $response = $kernel->handle(new Request()); - $this->assertEquals('foo', $kernel->handle(new Request())->getContent()); + $this->assertEquals('500', $response->getStatusCode()); + $this->assertEquals('foo', $response->getContent()); + } + + public function testHandleExceptionWithARedirectionResponse() + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { + $event->setResponse(new RedirectResponse('/login', 301)); + }); + + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new AccessDeniedHttpException(); })); + $response = $kernel->handle(new Request()); + + $this->assertEquals('301', $response->getStatusCode()); + $this->assertEquals('/login', $response->headers->get('Location')); + } + + public function testHandleHttpException() + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { + $event->setResponse(new Response($event->getException()->getMessage())); + }); + + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new MethodNotAllowedHttpException(array('POST')); })); + $response = $kernel->handle(new Request()); + + $this->assertEquals('405', $response->getStatusCode()); + $this->assertEquals('POST', $response->headers->get('Allow')); } public function testHandleWhenAListenerReturnsAResponse() @@ -225,7 +258,7 @@ class Controller return new Response('foo'); } - static public function staticController() + public static function staticController() { return new Response('foo'); } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php index 8fc46cc..0def224 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; +use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; use Symfony\Component\HttpKernel\Tests\Fixtures\FooBarBundle; class KernelTest extends \PHPUnit_Framework_TestCase @@ -292,7 +293,15 @@ EOF; { $kernel = new KernelForTest('test', true); - $this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', $kernel->getRootDir()); + $rootDir = __DIR__.DIRECTORY_SEPARATOR.'Fixtures'; + + // getRootDir() returns path with slashes + // without conversion test fails on Windows + if (defined('PHP_WINDOWS_VERSION_MAJOR')) { + $rootDir = strtr($rootDir, '\\', '/'); + } + + $this->assertEquals($rootDir, $kernel->getRootDir()); } public function testGetName() @@ -302,6 +311,13 @@ EOF; $this->assertEquals('Fixtures', $kernel->getName()); } + public function testOverrideGetName() + { + $kernel = new KernelForOverrideName('test', true); + + $this->assertEquals('overridden', $kernel->getName()); + } + public function testSerialize() { $env = 'test_env'; diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php index 15bcc39..62f24ce 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php @@ -209,6 +209,22 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase $this->assertCount(0, $this->getStorage()->find('127.0.0.1', '', 10, 'GET'), '->purge() removes all items from index'); } + public function testDuplicates() + { + for ($i = 1; $i <= 5; $i++) { + $profile = new Profile('foo' . $i); + $profile->setIp('127.0.0.1'); + $profile->setUrl('http://example.net/'); + $profile->setMethod('GET'); + + ///three duplicates + $this->getStorage()->write($profile); + $this->getStorage()->write($profile); + $this->getStorage()->write($profile); + } + $this->assertCount(3, $this->getStorage()->find('127.0.0.1', 'http://example.net/', 3, 'GET'), '->find() method returns incorrect number of entries'); + } + /** * @return \Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface */ diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index 16c615a..ad22512 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; +use Symfony\Component\HttpKernel\Profiler\Profile; class FileProfilerStorageTest extends AbstractProfilerStorageTest { @@ -57,4 +58,28 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest { return self::$storage; } + + public function testMultiRowIndexFile() + { + $iteration = 3; + for ($i = 0; $i < $iteration; $i++) { + $profile = new Profile('token' . $i); + $profile->setIp('127.0.0.' . $i); + $profile->setUrl('http://foo.bar/' . $i); + $storage = $this->getStorage(); + + $storage->write($profile); + $storage->write($profile); + $storage->write($profile); + } + + $handle = fopen(self::$tmpDir . '/index.csv', 'r'); + for ($i = 0; $i < $iteration; $i++) { + $row = fgetcsv($handle); + $this->assertEquals('token' . $i, $row[0]); + $this->assertEquals('127.0.0.' . $i, $row[1]); + $this->assertEquals('http://foo.bar/' . $i, $row[3]); + } + $this->assertFalse(fgetcsv($handle)); + } } diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php index 4679a0e..bff52e7 100644 --- a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -26,7 +26,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest { protected static $storage; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { if (extension_loaded('mongo')) { self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400); @@ -38,7 +38,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest } } - static public function tearDownAfterClass() + public static function tearDownAfterClass() { if (self::$storage) { self::$storage->purge(); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php index 0f2f684..deb0c0a 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php @@ -30,12 +30,12 @@ interface GeneratorDumperInterface * * @return string Executable code */ - function dump(array $options = array()); + public function dump(array $options = array()); /** * Gets the routes to dump. * * @return RouteCollection A RouteCollection instance */ - function getRoutes(); + public function getRoutes(); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php index 760d729..5601f14 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -31,9 +31,33 @@ class UrlGenerator implements UrlGeneratorInterface protected $context; protected $strictParameters = true; protected $logger; + + /** + * This array defines the characters (besides alphanumeric ones) that will not be percent-encoded in the path segment of the generated URL. + * + * PHP's rawurlencode() encodes all chars except "a-zA-Z0-9-._~" according to RFC 3986. But we want to allow some chars + * to be used in their literal form (reasons below). Other chars inside the path must of course be encoded, e.g. + * "?" and "#" (would be interpreted wrongly as query and fragment identifier), + * "'" and """ (are used as delimiters in HTML). + */ protected $decodedChars = array( - // %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitly allowed it) + // the slash can be used to designate a hierarchical structure and we want allow using it with this meaning + // some webservers don't allow the slash in encoded form in the path for security reasons anyway + // see http://stackoverflow.com/questions/4069002/http-400-if-2f-part-of-get-url-in-jboss '%2F' => '/', + // the following chars are general delimiters in the URI specification but have only special meaning in the authority component + // so they can safely be used in the path in unencoded form + '%40' => '@', + '%3A' => ':', + // these chars are only sub-delimiters that have no predefined meaning and can therefore be used literally + // so URI producing applications can use these chars to delimit subcomponents in a path segment without being encoded for better readability + '%3B' => ';', + '%2C' => ',', + '%3D' => '=', + '%2B' => '+', + '%21' => '!', + '%2A' => '*', + '%7C' => '|', ); protected $routes; @@ -144,7 +168,7 @@ class UrlGenerator implements UrlGeneratorInterface } if (!$isEmpty || !$optional) { - $url = $token[1].strtr(rawurlencode($tparams[$token[3]]), $this->decodedChars).$url; + $url = $token[1].$tparams[$token[3]].$url; } $optional = false; @@ -155,18 +179,29 @@ class UrlGenerator implements UrlGeneratorInterface } } - if (!$url) { + if ('' === $url) { $url = '/'; } + // do not encode the contexts base url as it is already encoded (see Symfony\Component\HttpFoundation\Request) + $url = $this->context->getBaseUrl().strtr(rawurlencode($url), $this->decodedChars); + + // the path segments "." and ".." are interpreted as relative reference when resolving a URI; see http://tools.ietf.org/html/rfc3986#section-3.3 + // so we need to encode them as they are not used for this purpose here + // otherwise we would generate a URI that, when followed by a user agent (e.g. browser), does not match this route + $url = strtr($url, array('/../' => '/%2E%2E/', '/./' => '/%2E/')); + if ('/..' === substr($url, -3)) { + $url = substr($url, 0, -2) . '%2E%2E'; + } elseif ('/.' === substr($url, -2)) { + $url = substr($url, 0, -1) . '%2E'; + } + // add a query string if needed $extra = array_diff_key($originParameters, $variables, $defaults); if ($extra && $query = http_build_query($extra, '', '&')) { $url .= '?'.$query; } - $url = $this->context->getBaseUrl().$url; - if ($this->context->getHost()) { $scheme = $this->context->getScheme(); if (isset($requirements['_scheme']) && ($req = strtolower($requirements['_scheme'])) && $scheme != $req) { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php index 220334f..e28c79d 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php @@ -39,5 +39,5 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface * * @api */ - function generate($name, $parameters = array(), $absolute = false); + public function generate($name, $parameters = array(), $absolute = false); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php index 6e5e2db..3003dfd 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php @@ -34,6 +34,7 @@ class ApacheUrlMatcher extends UrlMatcher public function match($pathinfo) { $parameters = array(); + $defaults = array(); $allow = array(); $match = false; @@ -44,26 +45,28 @@ class ApacheUrlMatcher extends UrlMatcher $name = substr($name, 9); } - if (0 === strpos($name, '_ROUTING_')) { + if (0 === strpos($name, '_ROUTING_DEFAULTS_')) { + $name = substr($name, 18); + $defaults[$name] = $value; + } elseif (0 === strpos($name, '_ROUTING_')) { $name = substr($name, 9); + if ('_route' == $name) { + $match = true; + $parameters[$name] = $value; + } elseif (0 === strpos($name, '_allow_')) { + $allow[] = substr($name, 7); + } else { + $parameters[$name] = $value; + } } else { continue; } - if ('_route' == $name) { - $match = true; - $parameters[$name] = $value; - } elseif (0 === strpos($name, '_allow_')) { - $allow[] = substr($name, 7); - } else { - $parameters[$name] = $value; - } - unset($_SERVER[$key]); } if ($match) { - return $parameters; + return $this->mergeDefaults($parameters, $defaults); } elseif (0 < count($allow)) { throw new MethodNotAllowedException($allow); } else { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php index 6e0561d..102488c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Routing\Matcher\Dumper; - /** * Dumps a set of Apache mod_rewrite rules. * @@ -75,7 +74,7 @@ class ApacheMatcherDumper extends MatcherDumper $variables[] = 'E=_ROUTING_'.$variable.':%'.($i + 1); } foreach ($route->getDefaults() as $key => $value) { - $variables[] = 'E=_ROUTING_'.$key.':'.strtr($value, array( + $variables[] = 'E=_ROUTING_DEFAULTS_'.$key.':'.strtr($value, array( ':' => '\\:', '=' => '\\=', '\\' => '\\\\', @@ -140,7 +139,7 @@ class ApacheMatcherDumper extends MatcherDumper * * @return string The escaped string */ - static private function escape($string, $char, $with) + private static function escape($string, $char, $with) { $escaped = false; $output = ''; diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php index 08d03f5..f85e4ce 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php @@ -26,12 +26,12 @@ interface MatcherDumperInterface * * @return string Executable code */ - function dump(array $options = array()); + public function dump(array $options = array()); /** * Gets the routes to dump. * * @return RouteCollection A RouteCollection instance */ - function getRoutes(); + public function getRoutes(); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php index 8826c59..51e8005 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php @@ -29,7 +29,7 @@ abstract class RedirectableUrlMatcher extends UrlMatcher implements Redirectable try { $parameters = parent::match($pathinfo); } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1)) { + if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) { throw $e; } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php index 7225c81..929ae9c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php @@ -31,5 +31,5 @@ interface RedirectableUrlMatcherInterface * * @api */ - function redirect($path, $route, $scheme = null); + public function redirect($path, $route, $scheme = null); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php index 6a5c235..b5def3d 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php @@ -12,16 +12,15 @@ namespace Symfony\Component\Routing\Matcher; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; /** - * UrlMatcherInterface is the interface that all URL matcher classes must implement. + * RequestMatcherInterface is the interface that all request matcher classes must implement. * * @author Fabien Potencier */ -interface RequestMatcherInterface extends RequestContextAwareInterface +interface RequestMatcherInterface { /** * Tries to match a request with a set of routes. @@ -36,5 +35,5 @@ interface RequestMatcherInterface extends RequestContextAwareInterface * @throws ResourceNotFoundException If no matching resource could be found * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed */ - function matchRequest(Request $request); + public function matchRequest(Request $request); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php index 33c7f54..b517907 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -157,19 +157,19 @@ class UrlMatcher implements UrlMatcherInterface */ protected function handleRouteRequirements($pathinfo, $name, Route $route) { - // check HTTP scheme requirement - $scheme = $route->getRequirement('_scheme'); - $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; + // check HTTP scheme requirement + $scheme = $route->getRequirement('_scheme'); + $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; - return array($status, null); + return array($status, null); } /** * Get merged default parameters. - * + * * @param array $params The parameters * @param array $defaults The defaults - * + * * @return array Merged default parameters */ protected function mergeDefaults($params, $defaults) diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php index afccf80..dd718b1 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php @@ -25,7 +25,7 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException; interface UrlMatcherInterface extends RequestContextAwareInterface { /** - * Tries to match a URL with a set of routes. + * Tries to match a URL path with a set of routes. * * If the matcher can not find information, it must throw one of the exceptions documented * below. @@ -39,5 +39,5 @@ interface UrlMatcherInterface extends RequestContextAwareInterface * * @api */ - function match($pathinfo); + public function match($pathinfo); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php index 8357b52..daf5254 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php @@ -23,7 +23,7 @@ interface RequestContextAwareInterface * * @api */ - function setContext(RequestContext $context); + public function setContext(RequestContext $context); /** * Gets the request context. @@ -32,5 +32,5 @@ interface RequestContextAwareInterface * * @api */ - function getContext(); + public function getContext(); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php index f18b0ed..318426a 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Routing; * * @api */ -class Route +class Route implements \Serializable { private $pattern; private $defaults; @@ -26,7 +26,7 @@ class Route private $options; private $compiled; - static private $compilers = array(); + private static $compilers = array(); /** * Constructor. @@ -55,6 +55,25 @@ class Route $this->compiled = null; } + public function serialize() + { + return serialize(array( + 'pattern' => $this->pattern, + 'defaults' => $this->defaults, + 'requirements' => $this->requirements, + 'options' => $this->options, + )); + } + + public function unserialize($data) + { + $data = unserialize($data); + $this->pattern = $data['pattern']; + $this->defaults = $data['defaults']; + $this->requirements = $data['requirements']; + $this->options = $data['options']; + } + /** * Returns the pattern. * diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php index 85acf33..000dad0 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php @@ -24,7 +24,7 @@ use Symfony\Component\Config\Resource\ResourceInterface; * * @api */ -class RouteCollection implements \IteratorAggregate +class RouteCollection implements \IteratorAggregate, \Countable { private $routes; private $resources; @@ -89,6 +89,21 @@ class RouteCollection implements \IteratorAggregate } /** + * Gets the number of Routes in this collection. + * + * @return int The number of routes in this collection, including nested collections + */ + public function count() + { + $count = 0; + foreach ($this->routes as $route) { + $count += $route instanceof RouteCollection ? count($route) : 1; + } + + return $count; + } + + /** * Adds a route. * * @param string $name The route name diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php index 5193665..f72e9e5 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php @@ -25,5 +25,5 @@ interface RouteCompilerInterface * * @return CompiledRoute A CompiledRoute instance */ - function compile(Route $route); + public function compile(Route $route); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php index 529a85f..a10ae34 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php @@ -28,5 +28,5 @@ interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface * * @return RouteCollection A RouteCollection instance */ - function getRouteCollection(); + public function getRouteCollection(); } diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php index dc080db..ff3c20c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php @@ -43,4 +43,3 @@ class RouteTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache index 25f6060..ea17bca 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache @@ -4,7 +4,11 @@ RewriteRule .* - [QSA,L] # foo RewriteCond %{REQUEST_URI} ^/foo/(baz|symfony)$ -RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_def:test] +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_DEFAULTS_def:test] + +# foobar +RewriteCond %{REQUEST_URI} ^/foo(?:/([^/]+))?$ +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foobar,E=_ROUTING_bar:%1,E=_ROUTING_DEFAULTS_bar:toto] # bar RewriteCond %{REQUEST_URI} ^/bar/([^/]+)$ @@ -58,7 +62,7 @@ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz5unsafe,E=_ROUTING_foo:%1] # baz6 RewriteCond %{REQUEST_URI} ^/test/baz$ -RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz6,E=_ROUTING_foo:bar\ baz] +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz6,E=_ROUTING_DEFAULTS_foo:bar\ baz] # baz7 RewriteCond %{REQUEST_URI} ^/te\ st/baz$ diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml index e645d9b..d5136cb 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml @@ -3,4 +3,3 @@ blog_show: defaults: { _controller: MyBlogBundle:Blog:show } options: compiler_class: RouteCompiler - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index b9a116f..852de41 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -229,6 +229,32 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/app.php/foo', $this->getGenerator($routes)->generate('test', array('default' => 'foo'))); } + public function testUrlEncoding() + { + // This tests the encoding of reserved characters that are used for delimiting of URI components (defined in RFC 3986) + // and other special ASCII chars. These chars are tested as static text path, variable path and query param. + $chars = '@:[]/()*\'" +,;-._~&$<>|{}%\\^`!?foo=bar#id'; + $routes = $this->getRoutes('test', new Route("/$chars/{varpath}", array(), array('varpath' => '.+'))); + $this->assertSame('/app.php/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' + . '/@:%5B%5D/%28%29*%27%22%20+,;-._~%26%24%3C%3E|%7B%7D%25%5C%5E%60!%3Ffoo=bar%23id' + . '?query=%40%3A%5B%5D%2F%28%29%2A%27%22+%2B%2C%3B-._%7E%26%24%3C%3E%7C%7B%7D%25%5C%5E%60%21%3Ffoo%3Dbar%23id', + $this->getGenerator($routes)->generate('test', array( + 'varpath' => $chars, + 'query' => $chars + )) + ); + } + + public function testEncodingOfRelativePathSegments() + { + $routes = $this->getRoutes('test', new Route('/dir/../dir/..')); + $this->assertSame('/app.php/dir/%2E%2E/dir/%2E%2E', $this->getGenerator($routes)->generate('test')); + $routes = $this->getRoutes('test', new Route('/dir/./dir/.')); + $this->assertSame('/app.php/dir/%2E/dir/%2E', $this->getGenerator($routes)->generate('test')); + $routes = $this->getRoutes('test', new Route('/a./.a/a../..a/...')); + $this->assertSame('/app.php/a./.a/a../..a/...', $this->getGenerator($routes)->generate('test')); + } + protected function getGenerator(RouteCollection $routes, array $parameters = array(), $logger = null) { $context = new RequestContext('/app.php'); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php index a30555b..c927ae4 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Routing\Tests\Loader; - abstract class AbstractAnnotationLoaderTest extends \PHPUnit_Framework_TestCase { protected function setUp() diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php index f4b30e3..74c3873 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php @@ -50,4 +50,3 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } } - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php index e68b618..e4e107c 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php @@ -50,6 +50,35 @@ class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase ), ), array( + 'Route with params and defaults', + '/hello/hugo', + array( + '_ROUTING__route' => 'hello', + '_ROUTING__controller' => 'AcmeBundle:Default:index', + '_ROUTING_name' => 'hugo', + '_ROUTING_DEFAULTS_name' => 'world', + ), + array( + 'name' => 'hugo', + '_route' => 'hello', + '_controller' => 'AcmeBundle:Default:index', + ), + ), + array( + 'Route with defaults only', + '/hello', + array( + '_ROUTING__route' => 'hello', + '_ROUTING__controller' => 'AcmeBundle:Default:index', + '_ROUTING_DEFAULTS_name' => 'world', + ), + array( + 'name' => 'world', + '_route' => 'hello', + '_controller' => 'AcmeBundle:Default:index', + ), + ), + array( 'REDIRECT_ envs', '/hello/world', array( @@ -66,4 +95,3 @@ class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php index 65cb454..2847564 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php @@ -17,9 +17,9 @@ use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper; class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../../Fixtures/'); } @@ -70,6 +70,11 @@ class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase array('def' => 'test'), array('bar' => 'baz|symfony') )); + // defaults parameters in pattern + $collection->add('foobar', new Route( + '/foo/{bar}', + array('bar' => 'toto') + )); // method requirement $collection->add('bar', new Route( '/bar/{foo}', diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 3677c7e..69b3c07 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -14,7 +14,6 @@ namespace Symfony\Component\Routing\Tests\Matcher\Dumper; use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase { diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php index 43c958b..b8ab264 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -27,6 +27,20 @@ class RedirectableUrlMatcherTest extends \PHPUnit_Framework_TestCase $matcher->match('/foo'); } + /** + * @expectedException Symfony\Component\Routing\Exception\ResourceNotFoundException + */ + public function testRedirectWhenNoSlashForNonSafeMethod() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo/')); + + $context = new RequestContext(); + $context->setMethod('POST'); + $matcher = $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($coll, $context)); + $matcher->match('/foo'); + } + public function testSchemeRedirect() { $coll = new RouteCollection(); diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php index aee0f9d..6a31cdc 100644 --- a/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php @@ -76,6 +76,18 @@ class RouteCollectionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/foo1', $this->getFirstNamedRoute($collection, 'foo')->getPattern()); } + public function testCount() + { + $collection = new RouteCollection(); + $collection->add('foo', new Route('/foo')); + + $collection1 = new RouteCollection(); + $collection->addCollection($collection1); + $collection1->add('foo1', new Route('/foo1')); + + $this->assertCount(2, $collection); + } + protected function getFirstNamedRoute(RouteCollection $routeCollection, $name) { foreach ($routeCollection as $key => $route) { diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php index 81a7d5f..fe9f33f 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php @@ -25,13 +25,13 @@ class Escaper // first to ensure proper escaping because str_replace operates iteratively // on the input arrays. This ordering of the characters avoids the use of strtr, // which performs more slowly. - static private $escapees = array('\\\\', '\\"', + private static $escapees = array('\\\\', '\\"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); - static private $escaped = array('\\"', '\\\\', + private static $escaped = array('\\"', '\\\\', "\\0", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "\\x0e", "\\x0f", "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17", @@ -45,7 +45,7 @@ class Escaper * * @return Boolean True if the value would require double quotes. */ - static public function requiresDoubleQuoting($value) + public static function requiresDoubleQuoting($value) { return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); } @@ -57,7 +57,7 @@ class Escaper * * @return string The quoted, escaped string */ - static public function escapeWithDoubleQuotes($value) + public static function escapeWithDoubleQuotes($value) { return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value)); } @@ -69,7 +69,7 @@ class Escaper * * @return Boolean True if the value would require single quotes. */ - static public function requiresSingleQuoting($value) + public static function requiresSingleQuoting($value) { return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ - ? | < > = ! % @ ` ]/x', $value); } @@ -81,7 +81,7 @@ class Escaper * * @return string The quoted, escaped string */ - static public function escapeWithSingleQuotes($value) + public static function escapeWithSingleQuotes($value) { return sprintf("'%s'", str_replace('\'', '\'\'', $value)); } diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php index 8bcfcda..df89285 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php @@ -29,7 +29,7 @@ class Inline * * @return array A PHP array representing the YAML string */ - static public function parse($value) + public static function parse($value) { $value = trim($value); @@ -75,7 +75,7 @@ class Inline * * @throws DumpException When trying to dump PHP resource */ - static public function dump($value) + public static function dump($value) { switch (true) { case is_resource($value): @@ -125,7 +125,7 @@ class Inline * * @return string The YAML string representing the PHP array */ - static private function dumpArray($value) + private static function dumpArray($value) { // array $keys = array_keys($value); @@ -162,7 +162,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static public function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) + public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) { if (in_array($scalar[$i], $stringDelimiters)) { // quoted scalar @@ -207,7 +207,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseQuotedScalar($scalar, &$i) + private static function parseQuotedScalar($scalar, &$i) { // Only check the current item we're dealing with (for sequences) $subject = substr($scalar, $i); @@ -242,7 +242,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseSequence($sequence, &$i = 0) + private static function parseSequence($sequence, &$i = 0) { $output = array(); $len = strlen($sequence); @@ -298,7 +298,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseMapping($mapping, &$i = 0) + private static function parseMapping($mapping, &$i = 0) { $output = array(); $len = strlen($mapping); @@ -359,7 +359,7 @@ class Inline * * @return string A YAML string */ - static private function evaluateScalar($scalar) + private static function evaluateScalar($scalar) { $scalar = trim($scalar); @@ -404,7 +404,7 @@ class Inline * * @return string The regular expression */ - static private function getTimestampRegex() + private static function getTimestampRegex() { return <<moveToNextLine()) { if ($this->isCurrentLineEmpty()) { continue; @@ -72,6 +73,11 @@ class Parser $isRef = $isInPlace = $isProcessed = false; if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) { + if ($context && 'mapping' == $context) { + throw new ParseException('You cannot define a sequence item when in a mapping'); + } + $context = 'sequence'; + if (isset($values['value']) && preg_match('#^&(?P[^ ]+) *(?P.*)#u', $values['value'], $matches)) { $isRef = $matches['ref']; $values['value'] = $matches['value']; @@ -104,6 +110,11 @@ class Parser } } } elseif (preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values)) { + if ($context && 'sequence' == $context) { + throw new ParseException('You cannot define a mapping item when in a sequence'); + } + $context = 'mapping'; + try { $key = Inline::parseScalar($values['key']); } catch (ParseException $e) { diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml index 753d829..e8506fc 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml @@ -23,4 +23,3 @@ yaml: | secondline: 2 php: | array('foo' => null, 'firstline' => 1, 'secondline' => 2) - diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml new file mode 100644 index 0000000..ec456ed --- /dev/null +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml @@ -0,0 +1 @@ +value: diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php index 6b4e2d4..e27482a 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php @@ -160,6 +160,31 @@ EOF; $this->parser->parse($yaml); } + /** + * @expectedException Symfony\Component\Yaml\Exception\ParseException + */ + public function testSequenceInAMapping() + { + Yaml::parse(<< + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Yaml\Tests; + +use Symfony\Component\Yaml\Yaml; + +class YamlTest extends \PHPUnit_Framework_TestCase +{ + + public function testParseAndDump() + { + $data = array('lorem' => 'ipsum', 'dolor' => 'sit'); + $yml = Yaml::dump($data); + $parsed = Yaml::parse($yml); + $this->assertEquals($data, $parsed); + + $filename = __DIR__.'/Fixtures/index.yml'; + $contents = file_get_contents($filename); + $parsedByFilename = Yaml::parse($filename); + $parsedByContents = Yaml::parse($contents); + $this->assertEquals($parsedByFilename, $parsedByContents); + } + + public function testEmbededPhp() + { + $filename = __DIR__.'/Fixtures/embededPhp.yml'; + Yaml::enablePhpParsing(); + $parsed = Yaml::parse($filename); + $this->assertEquals(array('value' => 6), $parsed); + } + +} diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php index 0061dfd..ac3a576 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php @@ -48,7 +48,7 @@ class Unescaper public function unescapeDoubleQuotedString($value) { $self = $this; - $callback = function($match) use($self) { + $callback = function($match) use ($self) { return $self->unescapeCharacter($match[0]); }; diff --git a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php index 29e9413..d35e67d 100644 --- a/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php @@ -22,9 +22,9 @@ use Symfony\Component\Yaml\Exception\ParseException; */ class Yaml { - static public $enablePhpParsing = false; + public static $enablePhpParsing = false; - static public function enablePhpParsing() + public static function enablePhpParsing() { self::$enablePhpParsing = true; } @@ -49,7 +49,7 @@ class Yaml * * @api */ - static public function parse($input) + public static function parse($input) { // if input is a file, process it $file = ''; @@ -102,7 +102,7 @@ class Yaml * * @api */ - static public function dump($array, $inline = 2) + public static function dump($array, $inline = 2) { $yaml = new Dumper();