diff --git a/composer.json b/composer.json index 97ef123..9fa6935 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "symfony/validator": "2.3.*", "symfony/yaml": "2.3.*", "twig/twig": "1.12.*", - "doctrine/common": "2.3.*", + "doctrine/common": "2.4.*@beta", "guzzle/http": "3.1.*", "kriswallsmith/assetic": "1.1.*@alpha", "symfony-cmf/routing": "1.1.*@alpha", diff --git a/composer.lock b/composer.lock index 75394ba..35f3e82 100644 --- a/composer.lock +++ b/composer.lock @@ -3,34 +3,38 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "9cad5a32fc0b4c0fac16fbda1b8ead16", + "hash": "99355ea2b3166a2c7d7029c8ddc76f4e", "packages": [ { - "name": "doctrine/common", - "version": "2.3.0", + "name": "doctrine/annotations", + "version": "v1.1.2", "source": { "type": "git", - "url": "https://github.com/doctrine/common", - "reference": "2.3.0" + "url": "https://github.com/doctrine/annotations.git", + "reference": "v1.1.2" }, "dist": { "type": "zip", - "url": "https://github.com/doctrine/common/zipball/2.3.0", - "reference": "2.3.0", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/v1.1.2", + "reference": "v1.1.2", "shasum": "" }, "require": { + "doctrine/lexer": "1.*", "php": ">=5.3.2" }, + "require-dev": { + "doctrine/cache": "1.*" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-0": { - "Doctrine\\Common": "lib/" + "Doctrine\\Common\\Annotations\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -59,7 +63,207 @@ { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2013-06-16 21:33:03" + }, + { + "name": "doctrine/cache", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/cache/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2013-01-10 22:43:46" + }, + { + "name": "doctrine/collections", + "version": "v1.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "v1.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/v1.1", + "reference": "v1.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2013-03-07 12:15:54" + }, + { + "name": "doctrine/common", + "version": "2.4.0-RC4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "2.4.0-RC4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/2.4.0-RC4", + "reference": "2.4.0-RC4", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -72,7 +276,122 @@ "persistence", "spl" ], - "time": "2012-09-19 22:55:18" + "time": "2013-06-21 12:11:28" + }, + { + "name": "doctrine/inflector", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/inflector/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluarlize", + "singuarlize", + "string" + ], + "time": "2013-01-10 21:49:15" + }, + { + "name": "doctrine/lexer", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/lexer/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2013-01-12 18:59:04" }, { "name": "easyrdf/easyrdf", @@ -1683,6 +2002,7 @@ ], "minimum-stability": "stable", "stability-flags": { + "doctrine/common": 10, "kriswallsmith/assetic": 15, "symfony-cmf/routing": 15, "easyrdf/easyrdf": 10 diff --git a/core/vendor/autoload.php b/core/vendor/autoload.php index 51fea2c..d0e42c0 100644 --- a/core/vendor/autoload.php +++ b/core/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit4ae4005bb4ec82f3372265feb7e84f37::getLoader(); +return ComposerAutoloaderInitae9396db2008f9b266cde1fb85dfa4f8::getLoader(); diff --git a/core/vendor/composer/autoload_namespaces.php b/core/vendor/composer/autoload_namespaces.php index 87cf570..44f503d 100644 --- a/core/vendor/composer/autoload_namespaces.php +++ b/core/vendor/composer/autoload_namespaces.php @@ -32,6 +32,11 @@ 'Drupal\\Driver' => array($baseDir . '/drivers/lib'), 'Drupal\\Core' => array($baseDir . '/core/lib'), 'Drupal\\Component' => array($baseDir . '/core/lib'), - 'Doctrine\\Common' => array($vendorDir . '/doctrine/common/lib'), + 'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'), + 'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'), + 'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'), + 'Doctrine\\Common\\Cache\\' => array($vendorDir . '/doctrine/cache/lib'), + 'Doctrine\\Common\\Annotations\\' => array($vendorDir . '/doctrine/annotations/lib'), + 'Doctrine\\Common\\' => array($vendorDir . '/doctrine/common/lib'), 'Assetic' => array($vendorDir . '/kriswallsmith/assetic/src'), ); diff --git a/core/vendor/composer/autoload_real.php b/core/vendor/composer/autoload_real.php index 7d1d4ad..c2b428f 100644 --- a/core/vendor/composer/autoload_real.php +++ b/core/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php generated by Composer -class ComposerAutoloaderInit4ae4005bb4ec82f3372265feb7e84f37 +class ComposerAutoloaderInitae9396db2008f9b266cde1fb85dfa4f8 { private static $loader; @@ -19,9 +19,9 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit4ae4005bb4ec82f3372265feb7e84f37', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitae9396db2008f9b266cde1fb85dfa4f8', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit4ae4005bb4ec82f3372265feb7e84f37', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitae9396db2008f9b266cde1fb85dfa4f8', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname(dirname($vendorDir)); diff --git a/core/vendor/composer/installed.json b/core/vendor/composer/installed.json index 322247d..8319606 100644 --- a/core/vendor/composer/installed.json +++ b/core/vendor/composer/installed.json @@ -1,76 +1,5 @@ [ { - "name": "doctrine/common", - "version": "2.3.0", - "version_normalized": "2.3.0.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common", - "reference": "2.3.0" - }, - "dist": { - "type": "zip", - "url": "https://github.com/doctrine/common/zipball/2.3.0", - "reference": "2.3.0", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "time": "2012-09-19 22:55:18", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-0": { - "Doctrine\\Common": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com", - "homepage": "http://www.instaclick.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", - "role": "Developer of wrapped JMSSerializerBundle" - } - ], - "description": "Common Library for Doctrine projects", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "collections", - "eventmanager", - "persistence", - "spl" - ] - }, - { "name": "easyrdf/easyrdf", "version": "0.8.0-beta.1", "version_normalized": "0.8.0.0-beta1", @@ -1731,5 +1660,405 @@ "feed", "zf2" ] + }, + { + "name": "doctrine/lexer", + "version": "v1.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/lexer/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-01-12 18:59:04", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ] + }, + { + "name": "doctrine/annotations", + "version": "v1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "v1.1.2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/v1.1.2", + "reference": "v1.1.2", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*" + }, + "time": "2013-06-16 21:33:03", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ] + }, + { + "name": "doctrine/collections", + "version": "v1.1", + "version_normalized": "1.1.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "v1.1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/v1.1", + "reference": "v1.1", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-03-07 12:15:54", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ] + }, + { + "name": "doctrine/cache", + "version": "v1.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/cache/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-01-10 22:43:46", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ] + }, + { + "name": "doctrine/inflector", + "version": "v1.0", + "version_normalized": "1.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/inflector/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-01-10 21:49:15", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluarlize", + "singuarlize", + "string" + ] + }, + { + "name": "doctrine/common", + "version": "2.4.0-RC4", + "version_normalized": "2.4.0.0-RC4", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "2.4.0-RC4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/2.4.0-RC4", + "reference": "2.4.0-RC4", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "time": "2013-06-21 12:11:28", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ] } ] diff --git a/core/vendor/doctrine/annotations/.travis.yml b/core/vendor/doctrine/annotations/.travis.yml new file mode 100644 index 0000000..f3dcb23 --- /dev/null +++ b/core/vendor/doctrine/annotations/.travis.yml @@ -0,0 +1,9 @@ +language: php + +php: + - 5.3 + - 5.4 + +before_script: + - composer --prefer-source --dev install + - phpunit diff --git a/core/vendor/doctrine/annotations/README.md b/core/vendor/doctrine/annotations/README.md new file mode 100644 index 0000000..faad51f --- /dev/null +++ b/core/vendor/doctrine/annotations/README.md @@ -0,0 +1,11 @@ +# Doctrine Annotations + +[![Build Status](https://travis-ci.org/doctrine/annotations.png?branch=master)](https://travis-ci.org/doctrine/annotations) + +Docblock Annotations Parser library (extracted from Doctrine Common). + +## Changelog + +### v1.1 + +* Add Exception when ZendOptimizer+ or Opcache is configured to drop comments diff --git a/core/vendor/doctrine/annotations/composer.json b/core/vendor/doctrine/annotations/composer.json new file mode 100644 index 0000000..3569cf4 --- /dev/null +++ b/core/vendor/doctrine/annotations/composer.json @@ -0,0 +1,30 @@ +{ + "name": "doctrine/annotations", + "type": "library", + "description": "Docblock Annotations Parser", + "keywords": ["annotations", "docblock", "parser"], + "homepage": "http://www.doctrine-project.org", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, + {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": ">=5.3.2", + "doctrine/lexer": "1.*" + }, + "require-dev": { + "doctrine/cache": "1.*" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Annotations\\": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attribute.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Attributes.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php diff --git a/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php new file mode 100644 index 0000000..315812f --- /dev/null +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php @@ -0,0 +1,85 @@ +. + */ + +namespace Doctrine\Common\Annotations\Annotation; + +/** + * Annotation that can be used to signal to the parser + * to check the available values during the parsing process. + * + * @since 2.4 + * @author Fabio B. Silva + * + * @Annotation + * @Attributes({ + * @Attribute("value", required = true, type = "array"), + * @Attribute("literal", required = false, type = "array") + * }) + */ +final class Enum +{ + /** + * @var array + */ + public $value; + + /** + * Literal target declaration. + * + * @var array + */ + public $literal; + + /** + * Annotation construct + * + * @param array $values + * + * @throws \InvalidArgumentException + */ + public function __construct(array $values) + { + if ( ! isset($values['literal'])) { + $values['literal'] = array(); + } + + foreach ($values['value'] as $var) { + if( ! is_scalar($var)) { + throw new \InvalidArgumentException(sprintf( + '@Enum supports only scalar values "%s" given.', + is_object($var) ? get_class($var) : gettype($var) + )); + } + } + + foreach ($values['literal'] as $key => $var) { + if( ! in_array($key, $values['value'])) { + throw new \InvalidArgumentException(sprintf( + 'Undefined enumerator value "%s" for literal "%s".', + $key , $var + )); + } + } + + $this->value = $values['value']; + $this->literal = $values['literal']; + } + +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Required.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/Annotation/Target.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php similarity index 81% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php index 109beeb..6cdb661 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationException.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php @@ -124,4 +124,35 @@ public static function requiredError($attributeName, $annotationName, $context, $expected )); } + + /** + * Creates a new AnnotationException describing a invalid enummerator. + * + * @since 2.4 + * @param string $attributeName + * @param string $annotationName + * @param string $context + * @param array $available + * @param mixed $given + * @return AnnotationException + */ + public static function enumeratorError($attributeName, $annotationName, $context, $available, $given) + { + throw new self(sprintf( + '[Enum Error] Attribute "%s" of @%s declared on %s accept only [%s], but got %s.', + $attributeName, + $annotationName, + $context, + implode(', ', $available), + is_object($given) ? get_class($given) : $given + )); + } + + /** + * @return AnnotationException + */ + public static function optimizerPlusSaveComments() + { + throw new self("You have to enable opcache.save_comments=1 or zend_optimizerplus.save_comments=1."); + } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php similarity index 95% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php index 286e7d0..ad4a264 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -60,7 +60,7 @@ 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, + 'inheritDoc'=> true, 'license'=> true, 'todo'=> 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, @@ -69,7 +69,7 @@ class AnnotationReader implements Reader 'Required' => true, 'Attribute' => true, 'Attributes' => true, 'Target' => true, 'SuppressWarnings' => true, 'ingroup' => true, 'code' => true, 'endcode' => true, - 'package_version' => true, + 'package_version' => true, 'fixme' => true ); /** @@ -124,6 +124,14 @@ static public function addGlobalIgnoredName($name) */ public function __construct() { + if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.save_comments') === "0" || ini_get('opcache.save_comments') === "0")) { + throw AnnotationException::optimizerPlusSaveComments(); + } + + if (extension_loaded('opcache') && ini_get('opcache.save_comments') == 0) { + throw AnnotationException::optimizerPlusSaveComments(); + } + AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php'); $this->parser = new DocParser; diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php similarity index 98% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php index dfa846a..6135f53 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/AnnotationRegistry.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php @@ -120,7 +120,7 @@ static public function loadAnnotationClass($class) } } else { foreach((array)$dirs AS $dir) { - if (file_exists($dir . DIRECTORY_SEPARATOR . $file)) { + if (is_file($dir . DIRECTORY_SEPARATOR . $file)) { require $dir . DIRECTORY_SEPARATOR . $file; return true; } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/CachedReader.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php similarity index 97% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php index c9a6f7a..ddc84d6 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocLexer.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php @@ -19,7 +19,7 @@ namespace Doctrine\Common\Annotations; -use Doctrine\Common\Lexer; +use Doctrine\Common\Lexer\AbstractLexer; /** * Simple lexer for docblock annotations. @@ -30,7 +30,7 @@ * @author Roman Borschel * @author Johannes M. Schmitt */ -final class DocLexer extends Lexer +final class DocLexer extends AbstractLexer { const T_NONE = 1; const T_INTEGER = 2; diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php similarity index 92% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php index de31e0b..9b5daec 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/DocParser.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php @@ -21,6 +21,7 @@ use Closure; use ReflectionClass; +use Doctrine\Common\Annotations\Annotation\Enum; use Doctrine\Common\Annotations\Annotation\Target; use Doctrine\Common\Annotations\Annotation\Attribute; use Doctrine\Common\Annotations\Annotation\Attributes; @@ -187,6 +188,26 @@ ) ), ), + 'Doctrine\Common\Annotations\Annotation\Enum' => array( + 'is_annotation' => true, + 'has_constructor' => true, + 'targets_literal' => 'ANNOTATION_PROPERTY', + 'targets' => Target::TARGET_PROPERTY, + 'default_property' => 'value', + 'properties' => array( + 'value' => 'value' + ), + 'attribute_types' => array( + 'value' => array( + 'type' => 'array', + 'required' => true, + ), + 'literal' => array( + 'type' => 'array', + 'required' => false, + ), + ), + ), ); /** @@ -393,13 +414,15 @@ private function collectAnnotationMetadata($name) { if (self::$metadataParser == null){ self::$metadataParser = new self(); - self::$metadataParser->setTarget(Target::TARGET_CLASS); self::$metadataParser->setIgnoreNotImportedAnnotations(true); + self::$metadataParser->setIgnoredAnnotationNames($this->ignoredAnnotationNames); self::$metadataParser->setImports(array( + 'enum' => 'Doctrine\Common\Annotations\Annotation\Enum', 'target' => 'Doctrine\Common\Annotations\Annotation\Target', 'attribute' => 'Doctrine\Common\Annotations\Annotation\Attribute', 'attributes' => 'Doctrine\Common\Annotations\Annotation\Attributes' )); + AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Enum.php'); AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Target.php'); AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Attribute.php'); AnnotationRegistry::registerFile(__DIR__ . '/Annotation/Attributes.php'); @@ -422,6 +445,9 @@ private function collectAnnotationMetadata($name) // verify that the class is really meant to be an annotation if ($metadata['is_annotation']) { + + self::$metadataParser->setTarget(Target::TARGET_CLASS); + foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) { if ($annotation instanceof Target) { $metadata['targets'] = $annotation->targets; @@ -459,10 +485,13 @@ private function collectAnnotationMetadata($name) // collect all public properties foreach ($class->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) { $metadata['properties'][$property->name] = $property->name; + + if(false === ($propertyComment = $property->getDocComment())) { + continue; + } // checks if the property has @var annotation - if ((false !== $propertyComment = $property->getDocComment()) - && false !== strpos($propertyComment, '@var') + if (false !== strpos($propertyComment, '@var') && preg_match('/@var\s+([^\s]+)/',$propertyComment, $matches)) { // literal type declaration $value = $matches[1]; @@ -489,6 +518,20 @@ private function collectAnnotationMetadata($name) $metadata['attribute_types'][$property->name]['required'] = false !== strpos($propertyComment, '@Required'); } } + + // checks if the property has @Enum + if (false !== strpos($propertyComment, '@Enum')){ + + $context = 'property ' . $class->name . "::\$" . $property->name; + self::$metadataParser->setTarget(Target::TARGET_PROPERTY); + + foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) { + if($annotation instanceof Enum) { + $metadata['enum'][$property->name]['value'] = $annotation->value; + $metadata['enum'][$property->name]['literal'] = ! empty($annotation->literal) ? $annotation->literal : $annotation->value; + } + } + } } // choose the first property as default property @@ -641,6 +684,16 @@ private function Annotation() $this->match(DocLexer::T_CLOSE_PARENTHESIS); } + if (isset(self::$annotationMetadata[$name]['enum'])) { + // checks all declared attributes + foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) { + // checks if the attribute is a valid enumerator + if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) { + throw AnnotationException::enumeratorError($property, $name, $this->context, $enum['literal'], $values[$property]); + } + } + } + // checks all declared attributes foreach (self::$annotationMetadata[$name]['attribute_types'] as $property => $type) { if ($property === self::$annotationMetadata[$name]['default_property'] @@ -659,7 +712,7 @@ private function Annotation() if ($type['type'] === 'array') { // handle the case of a single value - if (!is_array($values[$property])) { + if ( ! is_array($values[$property])) { $values[$property] = array($values[$property]); } @@ -929,6 +982,14 @@ private function Arrayx() $array = $values = array(); $this->match(DocLexer::T_OPEN_CURLY_BRACES); + + // If the array is empty, stop parsing and return. + if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) { + $this->match(DocLexer::T_CLOSE_CURLY_BRACES); + + return $array; + } + $values[] = $this->ArrayEntry(); while ($this->lexer->isNextToken(DocLexer::T_COMMA)) { diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php similarity index 90% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php index 3934861..5e937a8 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/FileCacheReader.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php @@ -48,6 +48,8 @@ class FileCacheReader implements Reader */ private $loadedAnnotations = array(); + private $classNameHashes = array(); + /** * Constructor * @@ -79,14 +81,17 @@ public function __construct(Reader $reader, $cacheDir, $debug = false) */ public function getClassAnnotations(\ReflectionClass $class) { - $key = $class->getName(); + if ( ! isset($this->classNameHashes[$class->name])) { + $this->classNameHashes[$class->name] = sha1($class->name); + } + $key = $this->classNameHashes[$class->name]; if (isset($this->loadedAnnotations[$key])) { return $this->loadedAnnotations[$key]; } $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; - if (!file_exists($path)) { + if (!is_file($path)) { $annot = $this->reader->getClassAnnotations($class); $this->saveCacheFile($path, $annot); return $this->loadedAnnotations[$key] = $annot; @@ -114,14 +119,17 @@ public function getClassAnnotations(\ReflectionClass $class) public function getPropertyAnnotations(\ReflectionProperty $property) { $class = $property->getDeclaringClass(); - $key = $class->getName().'$'.$property->getName(); + if ( ! isset($this->classNameHashes[$class->name])) { + $this->classNameHashes[$class->name] = sha1($class->name); + } + $key = $this->classNameHashes[$class->name].'$'.$property->getName(); if (isset($this->loadedAnnotations[$key])) { return $this->loadedAnnotations[$key]; } $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; - if (!file_exists($path)) { + if (!is_file($path)) { $annot = $this->reader->getPropertyAnnotations($property); $this->saveCacheFile($path, $annot); return $this->loadedAnnotations[$key] = $annot; @@ -130,7 +138,7 @@ public function getPropertyAnnotations(\ReflectionProperty $property) if ($this->debug && (false !== $filename = $class->getFilename()) && filemtime($path) < filemtime($filename)) { - unlink($path); + @unlink($path); $annot = $this->reader->getPropertyAnnotations($property); $this->saveCacheFile($path, $annot); @@ -149,14 +157,17 @@ public function getPropertyAnnotations(\ReflectionProperty $property) public function getMethodAnnotations(\ReflectionMethod $method) { $class = $method->getDeclaringClass(); - $key = $class->getName().'#'.$method->getName(); + if ( ! isset($this->classNameHashes[$class->name])) { + $this->classNameHashes[$class->name] = sha1($class->name); + } + $key = $this->classNameHashes[$class->name].'#'.$method->getName(); if (isset($this->loadedAnnotations[$key])) { return $this->loadedAnnotations[$key]; } $path = $this->dir.'/'.strtr($key, '\\', '-').'.cache.php'; - if (!file_exists($path)) { + if (!is_file($path)) { $annot = $this->reader->getMethodAnnotations($method); $this->saveCacheFile($path, $annot); return $this->loadedAnnotations[$key] = $annot; @@ -165,7 +176,7 @@ public function getMethodAnnotations(\ReflectionMethod $method) if ($this->debug && (false !== $filename = $class->getFilename()) && filemtime($path) < filemtime($filename)) { - unlink($path); + @unlink($path); $annot = $this->reader->getMethodAnnotations($method); $this->saveCacheFile($path, $annot); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/IndexedReader.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php similarity index 92% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php rename to core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php index c09dd51..9d61020 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Annotations/PhpParser.php +++ b/core/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php @@ -46,7 +46,12 @@ public function parseClass(\ReflectionClass $class) } $content = $this->getFileContent($filename, $class->getStartLine()); - $namespace = str_replace('\\', '\\\\', $class->getNamespaceName()); + + if (null === $content) { + return array(); + } + + $namespace = preg_quote($class->getNamespaceName()); $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content); $tokenizer = new TokenParser(' + + + + + ./tests/Doctrine/ + + + + + + ./lib/Doctrine/ + + + + + + performance + + + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php similarity index 88% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php index 4261e6b..ea52b02 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php +++ b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php @@ -3,8 +3,6 @@ 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; @@ -24,23 +22,14 @@ public function getReflectionClass() { $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()), - ); + return new ReflectionClass($className); } - /** - * @dataProvider getReflectionClass - */ - public function testAnnotations($class) + public function testAnnotations() { + $class = $this->getReflectionClass(); $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); @@ -114,6 +103,13 @@ public function testClassWithInvalidAnnotationTargetAtClassDocBlock() $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtClass')); } + public function testClassWithWithInclude() + { + $reader = $this->getReader(); + $annots = $reader->getClassAnnotations(new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithRequire')); + $this->assertCount(1, $annots); + } + /** * @expectedException Doctrine\Common\Annotations\AnnotationException * @expectedExceptionMessage [Semantical Error] Annotation @AnnotationTargetClass is not allowed to be declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithInvalidAnnotationTargetAtProperty::$foo. You may only use this annotation on these code elements: CLASS @@ -343,6 +339,45 @@ public function testInvalidAnnotationButIgnored() $this->assertCount(0, $reader->getPropertyAnnotations($class->getProperty('foo'))); } + public function testAnnotationEnumeratorException() + { + $reader = $this->getReader(); + $class = new \ReflectionClass('Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationEnum'); + + $this->assertCount(1, $bar = $reader->getMethodAnnotations($class->getMethod('bar'))); + $this->assertCount(1, $foo = $reader->getPropertyAnnotations($class->getProperty('foo'))); + + $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum', $bar[0]); + $this->assertInstanceOf('Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum', $foo[0]); + + try { + $reader->getPropertyAnnotations($class->getProperty('invalidProperty')); + $this->fail(); + } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { + $this->assertEquals('[Enum Error] Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on property Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationEnum::$invalidProperty accept only [ONE, TWO, THREE], but got FOUR.', $exc->getMessage()); + } + + try { + $reader->getMethodAnnotations($class->getMethod('invalidMethod')); + $this->fail(); + } catch (\Doctrine\Common\Annotations\AnnotationException $exc) { + $this->assertEquals('[Enum Error] Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithAnnotationEnum::invalidMethod() accept only [ONE, TWO, THREE], but got 5.', $exc->getMessage()); + } + } + + /** + * @group DCOM-106 + */ + public function testIgnoreFixMeAndUpperCaseToDo() + { + $reader = $this->getReader(); + $ref = new \ReflectionClass('Doctrine\Tests\Common\Annotations\DCOM106'); + $reader->getClassAnnotations($ref); + } + + /** + * @return AnnotationReader + */ abstract protected function getReader(); } @@ -438,6 +473,15 @@ class DummyGeneratedValue extends \Doctrine\Common\Annotations\Annotation {} class DummyAnnotation extends \Doctrine\Common\Annotations\Annotation { public $dummyValue; } + +/** + * @api + * @Annotation + */ +class DummyAnnotationWithIgnoredAnnotation extends \Doctrine\Common\Annotations\Annotation { + public $dummyValue; +} + /** @Annotation */ class DummyJoinColumn extends \Doctrine\Common\Annotations\Annotation { public $name; @@ -500,6 +544,16 @@ class DummyClassWithEmail } + +/** + * @fixme public + * @TODO + */ +class DCOM106 +{ + +} + namespace Doctrine\Tests\Common\Annotations\Foo; /** @Annotation */ diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/CachedReaderTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocLexerTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php similarity index 93% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php index b14698f..6c8016f 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php +++ b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DocParserTest.php @@ -665,6 +665,62 @@ public function testAnnotationWithRequiredAttributesWithoutContructor() } + /** + * @expectedException Doctrine\Common\Annotations\AnnotationException + * @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum declared on property SomeClassName::invalidProperty. accept only [ONE, TWO, THREE], but got FOUR. + */ + public function testAnnotationEnumeratorException() + { + $parser = $this->createTestParser(); + $context = 'property SomeClassName::invalidProperty.'; + $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnum("FOUR")'; + + $parser->setIgnoreNotImportedAnnotations(false); + $parser->setTarget(Target::TARGET_PROPERTY); + $parser->parse($docblock, $context); + } + + /** + * @expectedException Doctrine\Common\Annotations\AnnotationException + * @expectedExceptionMessage Attribute "value" of @Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteral declared on property SomeClassName::invalidProperty. accept only [AnnotationEnumLiteral::ONE, AnnotationEnumLiteral::TWO, AnnotationEnumLiteral::THREE], but got 4. + */ + public function testAnnotationEnumeratorLiteralException() + { + $parser = $this->createTestParser(); + $context = 'property SomeClassName::invalidProperty.'; + $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteral(4)'; + + $parser->setIgnoreNotImportedAnnotations(false); + $parser->setTarget(Target::TARGET_PROPERTY); + $parser->parse($docblock, $context); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage @Enum supports only scalar values "array" given. + */ + public function testAnnotationEnumInvalidTypeDeclarationException() + { + $parser = $this->createTestParser(); + $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumInvalid("foo")'; + + $parser->setIgnoreNotImportedAnnotations(false); + $parser->parse($docblock); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage Undefined enumerator value "3" for literal "AnnotationEnumLiteral::THREE". + */ + public function testAnnotationEnumInvalidLiteralDeclarationException() + { + $parser = $this->createTestParser(); + $docblock = '@Doctrine\Tests\Common\Annotations\Fixtures\AnnotationEnumLiteralInvalid("foo")'; + + $parser->setIgnoreNotImportedAnnotations(false); + $parser->parse($docblock); + } + public function getConstantsProvider() { $provider[] = array( @@ -1142,6 +1198,18 @@ public function testInvalidContantName() $parser = $this->createTestParser(); $parser->parse('@Name(foo: "bar")'); } + + /** + * Tests parsing empty arrays. + */ + public function testEmptyArray() + { + $parser = $this->createTestParser(); + + $annots = $parser->parse('@Name({"foo": {}})'); + $this->assertEquals(1, count($annots)); + $this->assertEquals(array('foo' => array()), $annots[0]->value); + } } /** @Annotation */ diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DummyClass.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/DummyClass.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/DummyClass.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/FileCacheReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/FileCacheReaderTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/FileCacheReaderTest.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/FileCacheReaderTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/AnnotWithDefaultValue.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Autoload.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Autoload.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Autoload.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Autoload.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Route.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Route.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Route.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Route.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Secure.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Secure.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Secure.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Secure.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Template.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Version.php diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationEnum.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationEnum.php new file mode 100644 index 0000000..cc9862a --- /dev/null +++ b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Fixtures/AnnotationEnum.php @@ -0,0 +1,21 @@ +assertEquals(array(), $parser->parseClass(new \ReflectionClass('\stdClass'))); } + public function testClassFileDoesNotExist() + { + $class = $this->getMockBuilder('\ReflectionClass') + ->disableOriginalConstructor() + ->getMock(); + $class->expects($this->once()) + ->method('getFilename') + ->will($this->returnValue('/valid/class/Fake.php(35) : eval()d code')); + + $parser = new PhpParser(); + $this->assertEquals(array(), $parser->parseClass($class)); + } + public function testParseClassWhenClassIsNotNamespaced() { $parser = new PhpParser(); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/SimpleAnnotationReaderTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM55Test.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Entity.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Test.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Test.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Test.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/Ticket/DCOM58Test.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php rename to core/vendor/doctrine/annotations/tests/Doctrine/Tests/Common/Annotations/TopLevelAnnotation.php diff --git a/core/vendor/doctrine/annotations/tests/Doctrine/Tests/DoctrineTestCase.php b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/DoctrineTestCase.php new file mode 100644 index 0000000..e8323d2 --- /dev/null +++ b/core/vendor/doctrine/annotations/tests/Doctrine/Tests/DoctrineTestCase.php @@ -0,0 +1,10 @@ +=5.3.2" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Cache\\": "lib/" } + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ApcCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ApcCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ArrayCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ArrayCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php similarity index 98% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php index 5493562..d4e86f4 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/Cache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/Cache.php @@ -96,7 +96,7 @@ function delete($id); * Memory allowed to use for storage. * * @since 2.2 - * @var array Associative array with server's statistics if available, NULL otherwise. + * @return array Associative array with server's statistics if available, NULL otherwise. */ function getStats(); } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/CacheProvider.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CacheProvider.php diff --git a/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php new file mode 100644 index 0000000..f0e5f90 --- /dev/null +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/CouchbaseCache.php @@ -0,0 +1,123 @@ +. + */ + +namespace Doctrine\Common\Cache; + +use \Couchbase; + +/** + * Couchbase cache provider. + * + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @link www.doctrine-project.org + * @since 2.4 + * @author Michael Nitschinger + */ +class CouchbaseCache extends CacheProvider +{ + + /** + * @var Couchbase + */ + private $couchbase; + + /** + * Sets the Couchbase instance to use. + * + * @param Couchbase $couchbase + */ + public function setCouchbase(Couchbase $couchbase) + { + $this->couchbase = $couchbase; + } + + /** + * Gets the Couchbase instance used by the cache. + * + * @return Couchbase + */ + public function getCouchbase() + { + return $this->couchbase; + } + + /** + * {@inheritdoc} + */ + protected function doFetch($id) + { + return $this->couchbase->get($id) ?: false; + } + + /** + * {@inheritdoc} + */ + protected function doContains($id) + { + return (null !== $this->couchbase->get($id)); + } + + /** + * {@inheritdoc} + */ + protected function doSave($id, $data, $lifeTime = 0) + { + if ($lifeTime > 30 * 24 * 3600) { + $lifeTime = time() + $lifeTime; + } + return $this->couchbase->set($id, $data, (int) $lifeTime); + } + + /** + * {@inheritdoc} + */ + protected function doDelete($id) + { + return $this->couchbase->delete($id); + } + + /** + * {@inheritdoc} + */ + protected function doFlush() + { + return $this->couchbase->flush(); + } + + /** + * {@inheritdoc} + */ + protected function doGetStats() + { + $stats = $this->couchbase->getStats(); + $servers = $this->couchbase->getServers(); + $server = explode(":", $servers[0]); + $key = $server[0] . ":" . "11210"; + $stats = $stats[$key]; + return array( + Cache::STATS_HITS => $stats['get_hits'], + Cache::STATS_MISSES => $stats['get_misses'], + Cache::STATS_UPTIME => $stats['uptime'], + Cache::STATS_MEMORY_USAGE => $stats['bytes'], + Cache::STATS_MEMORY_AVAILIABLE => $stats['limit_maxbytes'], + ); + } + +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php similarity index 97% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php index a27a717..a431438 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FilesystemCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php @@ -44,7 +44,7 @@ protected function doFetch($id) $lifetime = -1; $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } @@ -77,7 +77,7 @@ protected function doContains($id) $lifetime = -1; $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcacheCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcacheCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/MemcachedCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/MemcachedCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php similarity index 97% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php index 0971cd9..1d69d3d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/PhpFileCache.php +++ b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php @@ -42,7 +42,7 @@ protected function doFetch($id) { $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } @@ -62,7 +62,7 @@ protected function doContains($id) { $filename = $this->getFilename($id); - if ( ! file_exists($filename)) { + if ( ! is_file($filename)) { return false; } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/RedisCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/RedisCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/RedisCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/WinCacheCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/WinCacheCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/XcacheCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/XcacheCache.php diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php b/core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php similarity index 100% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Cache/ZendDataCache.php rename to core/vendor/doctrine/cache/lib/Doctrine/Common/Cache/ZendDataCache.php diff --git a/core/vendor/doctrine/cache/phpunit.xml.dist b/core/vendor/doctrine/cache/phpunit.xml.dist new file mode 100644 index 0000000..900378b --- /dev/null +++ b/core/vendor/doctrine/cache/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + ./tests/Doctrine/ + + + + + + ./lib/Doctrine/ + + + + + + performance + + + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ApcCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ArrayCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php similarity index 87% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php index 1bbc165..ea7f753 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/CacheTest.php +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CacheTest.php @@ -85,6 +85,18 @@ public function testGetStats() } /** + * Make sure that all supported caches return "false" instead of "null" to be compatible + * with ORM integration. + */ + public function testFalseOnFailedFetch() + { + $cache = $this->_getCacheDriver(); + $result = $cache->fetch('nonexistent_key'); + $this->assertFalse($result); + $this->assertNotNull($result); + } + + /** * @return \Doctrine\Common\Cache\CacheProvider */ abstract protected function _getCacheDriver(); diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php new file mode 100644 index 0000000..40d5a69 --- /dev/null +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/CouchbaseCacheTest.php @@ -0,0 +1,47 @@ +couchbase = new Couchbase('127.0.0.1', 'Administrator', 'password', 'default'); + } catch(Exception $ex) { + $this->markTestSkipped('Could not instantiate the Couchbase cache because of: ' . $ex); + } + } else { + $this->markTestSkipped('The ' . __CLASS__ .' requires the use of the couchbase extension'); + } + } + + public function testNoExpire() + { + $cache = $this->_getCacheDriver(); + $cache->save('noexpire', 'value', 0); + sleep(1); + $this->assertTrue($cache->contains('noexpire'), 'Couchbase provider should support no-expire'); + } + + public function testLongLifetime() + { + $cache = $this->_getCacheDriver(); + $cache->save('key', 'value', 30 * 24 * 3600 + 1); + + $this->assertTrue($cache->contains('key'), 'Couchbase provider should support TTL > 30 days'); + } + + protected function _getCacheDriver() + { + $driver = new CouchbaseCache(); + $driver->setCouchbase($this->couchbase); + return $driver; + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/FilesystemCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcacheCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/MemcachedCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/PhpFileCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/RedisCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/WinCacheCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/XcacheCacheTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php rename to core/vendor/doctrine/cache/tests/Doctrine/Tests/Common/Cache/ZendDataCacheTest.php diff --git a/core/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php b/core/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php new file mode 100644 index 0000000..e8323d2 --- /dev/null +++ b/core/vendor/doctrine/cache/tests/Doctrine/Tests/DoctrineTestCase.php @@ -0,0 +1,10 @@ +=5.3.2" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Collections\\": "lib/" } + }, + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php similarity index 51% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php index 7c2b13e..9c2c8e1 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ArrayCollection.php @@ -20,16 +20,15 @@ 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. * - * @since 2.0 - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ class ArrayCollection implements Collection, Selectable { @@ -51,9 +50,7 @@ public function __construct(array $elements = array()) } /** - * Gets the PHP array representation of this collection. - * - * @return array The PHP array representation of this collection. + * {@inheritDoc} */ public function toArray() { @@ -61,10 +58,7 @@ public function toArray() } /** - * Sets the internal iterator to the first element in the collection and - * returns this element. - * - * @return mixed + * {@inheritDoc} */ public function first() { @@ -72,10 +66,7 @@ public function first() } /** - * Sets the internal iterator to the last element in the collection and - * returns this element. - * - * @return mixed + * {@inheritDoc} */ public function last() { @@ -83,9 +74,7 @@ public function last() } /** - * Gets the current key/index at the current internal iterator position. - * - * @return mixed + * {@inheritDoc} */ public function key() { @@ -93,9 +82,7 @@ public function key() } /** - * Moves the internal iterator position to the next element. - * - * @return mixed + * {@inheritDoc} */ public function next() { @@ -103,9 +90,7 @@ public function next() } /** - * Gets the element of the collection at the current internal iterator position. - * - * @return mixed + * {@inheritDoc} */ public function current() { @@ -113,14 +98,11 @@ public function current() } /** - * Removes an element with a specific key/index from the collection. - * - * @param mixed $key - * @return mixed The removed element or NULL, if no element exists for the given key. + * {@inheritDoc} */ public function remove($key) { - if (isset($this->_elements[$key])) { + if (isset($this->_elements[$key]) || array_key_exists($key, $this->_elements)) { $removed = $this->_elements[$key]; unset($this->_elements[$key]); @@ -131,10 +113,7 @@ public function remove($key) } /** - * Removes the specified element from the collection, if it is found. - * - * @param mixed $element The element to remove. - * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. + * {@inheritDoc} */ public function removeElement($element) { @@ -150,12 +129,9 @@ public function removeElement($element) } /** - * ArrayAccess implementation of offsetExists() - * - * @see containsKey() + * Required by interface ArrayAccess. * - * @param mixed $offset - * @return bool + * {@inheritDoc} */ public function offsetExists($offset) { @@ -163,12 +139,9 @@ public function offsetExists($offset) } /** - * ArrayAccess implementation of offsetGet() + * Required by interface ArrayAccess. * - * @see get() - * - * @param mixed $offset - * @return mixed + * {@inheritDoc} */ public function offsetGet($offset) { @@ -176,14 +149,9 @@ public function offsetGet($offset) } /** - * ArrayAccess implementation of offsetSet() - * - * @see add() - * @see set() + * Required by interface ArrayAccess. * - * @param mixed $offset - * @param mixed $value - * @return bool + * {@inheritDoc} */ public function offsetSet($offset, $value) { @@ -194,12 +162,9 @@ public function offsetSet($offset, $value) } /** - * ArrayAccess implementation of offsetUnset() - * - * @see remove() + * Required by interface ArrayAccess. * - * @param mixed $offset - * @return mixed + * {@inheritDoc} */ public function offsetUnset($offset) { @@ -207,42 +172,23 @@ public function offsetUnset($offset) } /** - * Checks whether the collection contains a specific key/index. - * - * @param mixed $key The key to check for. - * @return boolean TRUE if the given key/index exists, FALSE otherwise. + * {@inheritDoc} */ public function containsKey($key) { - return isset($this->_elements[$key]); + return isset($this->_elements[$key]) || array_key_exists($key, $this->_elements); } /** - * Checks whether the given element is contained in the collection. - * Only element values are compared, not keys. The comparison of two elements - * is strict, that means not only the value but also the type must match. - * For objects this means reference equality. - * - * @param mixed $element - * @return boolean TRUE if the given element is contained in the collection, - * FALSE otherwise. + * {@inheritDoc} */ public function contains($element) { - foreach ($this->_elements as $collectionElement) { - if ($element === $collectionElement) { - return true; - } - } - - return false; + return in_array($element, $this->_elements, true); } /** - * 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. + * {@inheritDoc} */ public function exists(Closure $p) { @@ -255,13 +201,7 @@ public function exists(Closure $p) } /** - * Searches for a given element and, if found, returns the corresponding key/index - * of that element. The comparison of two elements is strict, that means not - * only the value but also the type must match. - * For objects this means reference equality. - * - * @param mixed $element The element to search for. - * @return mixed The key/index of the element or FALSE if the element was not found. + * {@inheritDoc} */ public function indexOf($element) { @@ -269,10 +209,7 @@ public function indexOf($element) } /** - * Gets the element with the given key/index. - * - * @param mixed $key The key. - * @return mixed The element or NULL, if no element exists for the given key. + * {@inheritDoc} */ public function get($key) { @@ -283,9 +220,7 @@ public function get($key) } /** - * Gets all keys/indexes of the collection elements. - * - * @return array + * {@inheritDoc} */ public function getKeys() { @@ -293,9 +228,7 @@ public function getKeys() } /** - * Gets all elements. - * - * @return array + * {@inheritDoc} */ public function getValues() { @@ -303,11 +236,7 @@ public function getValues() } /** - * Returns the number of elements in the collection. - * - * Implementation of the Countable interface. - * - * @return integer The number of elements in the collection. + * {@inheritDoc} */ public function count() { @@ -315,13 +244,7 @@ public function count() } /** - * Adds/sets an element in the collection at the index / with the specified key. - * - * When the collection is a Map this is like put(key,value)/add(key,value). - * When the collection is a List this is like add(position,value). - * - * @param mixed $key - * @param mixed $value + * {@inheritDoc} */ public function set($key, $value) { @@ -329,10 +252,7 @@ public function set($key, $value) } /** - * Adds an element to the collection. - * - * @param mixed $value - * @return boolean Always TRUE. + * {@inheritDoc} */ public function add($value) { @@ -341,11 +261,7 @@ public function add($value) } /** - * Checks whether the collection is empty. - * - * Note: This is preferable over count() == 0. - * - * @return boolean TRUE if the collection is empty, FALSE otherwise. + * {@inheritDoc} */ public function isEmpty() { @@ -353,9 +269,9 @@ public function isEmpty() } /** - * Gets an iterator for iterating over the elements in the collection. + * Required by interface IteratorAggregate. * - * @return ArrayIterator + * {@inheritDoc} */ public function getIterator() { @@ -363,11 +279,7 @@ public function getIterator() } /** - * Applies the given function to each element in the collection and returns - * a new collection with the elements returned by the function. - * - * @param Closure $func - * @return Collection + * {@inheritDoc} */ public function map(Closure $func) { @@ -375,11 +287,7 @@ public function map(Closure $func) } /** - * Returns all the elements of this collection that satisfy the predicate p. - * The order of the elements is preserved. - * - * @param Closure $p The predicate used for filtering. - * @return Collection A collection with the results of the filter operation. + * {@inheritDoc} */ public function filter(Closure $p) { @@ -387,11 +295,7 @@ public function filter(Closure $p) } /** - * Applies the given predicate p to all elements of this collection, - * returning true, if the predicate yields true for all elements. - * - * @param Closure $p The predicate. - * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise. + * {@inheritDoc} */ public function forAll(Closure $p) { @@ -405,13 +309,7 @@ public function forAll(Closure $p) } /** - * Partitions this collection in two collections according to a predicate. - * Keys are preserved in the resulting collections. - * - * @param Closure $p The predicate on which to partition. - * @return array An array with two elements. The first element contains the collection - * of elements where the predicate returned TRUE, the second element - * contains the collection of elements where the predicate returned FALSE. + * {@inheritDoc} */ public function partition(Closure $p) { @@ -437,7 +335,7 @@ public function __toString() } /** - * Clears the collection. + * {@inheritDoc} */ public function clear() { @@ -445,15 +343,7 @@ public function clear() } /** - * Extract a slice of $length elements starting at position $offset from the Collection. - * - * If $length is null it returns all elements from $offset to the end of the Collection. - * Keys have to be preserved by this method. Calling this method will only return the - * selected slice and NOT change the elements contained in the collection slice is called on. - * - * @param int $offset - * @param int $length - * @return array + * {@inheritDoc} */ public function slice($offset, $length = null) { @@ -461,11 +351,7 @@ public function slice($offset, $length = null) } /** - * Select all elements from a selectable that match the criteria and - * return a new collection containing these elements. - * - * @param Criteria $criteria - * @return Collection + * {@inheritDoc} */ public function matching(Criteria $criteria) { @@ -497,4 +383,3 @@ public function matching(Criteria $criteria) return new static($filtered); } } - diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php similarity index 86% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php index 51eb9e7..0edf054 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Collection.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Collection.php @@ -38,10 +38,10 @@ * position unless you explicitly positioned it before. Prefer iteration with * external iterators. * - * @since 2.0 - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ interface Collection extends Countable, IteratorAggregate, ArrayAccess { @@ -49,12 +49,15 @@ * Adds an element at the end of the collection. * * @param mixed $element The element to add. + * * @return boolean Always TRUE. */ function add($element); /** * Clears the collection, removing all elements. + * + * @return void */ function clear(); @@ -63,6 +66,7 @@ function clear(); * This is an O(n) operation, where n is the size of the collection. * * @param mixed $element The element to search for. + * * @return boolean TRUE if the collection contains the element, FALSE otherwise. */ function contains($element); @@ -78,6 +82,7 @@ function isEmpty(); * Removes the element at the specified index from the collection. * * @param string|integer $key The kex/index of the element to remove. + * * @return mixed The removed element or NULL, if the collection did not contain the element. */ function remove($key); @@ -86,6 +91,7 @@ function remove($key); * Removes the specified element from the collection, if it is found. * * @param mixed $element The element to remove. + * * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. */ function removeElement($element); @@ -94,8 +100,9 @@ function removeElement($element); * Checks whether the collection contains an element with the specified key/index. * * @param string|integer $key The key/index to check for. + * * @return boolean TRUE if the collection contains an element with the specified key/index, - * FALSE otherwise. + * FALSE otherwise. */ function containsKey($key); @@ -103,6 +110,7 @@ function containsKey($key); * Gets the element at the specified key/index. * * @param string|integer $key The key/index of the element to retrieve. + * * @return mixed */ function get($key); @@ -111,7 +119,7 @@ function get($key); * Gets all keys/indices of the collection. * * @return array The keys/indices of the collection, in the order of the corresponding - * elements in the collection. + * elements in the collection. */ function getKeys(); @@ -119,15 +127,17 @@ function getKeys(); * Gets all values of the collection. * * @return array The values of all elements in the collection, in the order they - * appear in the collection. + * appear in the collection. */ function getValues(); /** * Sets an element in the collection at the specified key/index. * - * @param string|integer $key The key/index of the element to set. - * @param mixed $value The element to set. + * @param string|integer $key The key/index of the element to set. + * @param mixed $value The element to set. + * + * @return void */ function set($key, $value); @@ -139,16 +149,14 @@ function set($key, $value); function toArray(); /** - * Sets the internal iterator to the first element in the collection and - * returns this element. + * Sets the internal iterator to the first element in the collection and returns this element. * * @return mixed */ function first(); /** - * Sets the internal iterator to the last element in the collection and - * returns this element. + * Sets the internal iterator to the last element in the collection and returns this element. * * @return mixed */ @@ -157,18 +165,21 @@ function last(); /** * Gets the key/index of the element at the current iterator position. * + * @return int|string */ function key(); /** * Gets the element of the collection at the current iterator position. * + * @return mixed */ function current(); /** - * Moves the internal iterator position to the next element. + * Moves the internal iterator position to the next element and returns this element. * + * @return mixed */ function next(); @@ -176,6 +187,7 @@ function next(); * 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. */ function exists(Closure $p); @@ -185,6 +197,7 @@ function exists(Closure $p); * The order of the elements is preserved. * * @param Closure $p The predicate used for filtering. + * * @return Collection A collection with the results of the filter operation. */ function filter(Closure $p); @@ -194,6 +207,7 @@ function filter(Closure $p); * returning true, if the predicate yields true for all elements. * * @param Closure $p The predicate. + * * @return boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise. */ function forAll(Closure $p); @@ -203,6 +217,7 @@ function forAll(Closure $p); * a new collection with the elements returned by the function. * * @param Closure $func + * * @return Collection */ function map(Closure $func); @@ -212,6 +227,7 @@ function map(Closure $func); * Keys are preserved in the resulting collections. * * @param Closure $p The predicate on which to partition. + * * @return array An array with two elements. The first element contains the collection * of elements where the predicate returned TRUE, the second element * contains the collection of elements where the predicate returned FALSE. @@ -224,19 +240,21 @@ function partition(Closure $p); * For objects this means reference equality. * * @param mixed $element The element to search for. - * @return mixed The key/index of the element or FALSE if the element was not found. + * + * @return int|string|bool The key/index of the element or FALSE if the element was not found. */ function indexOf($element); /** - * Extract a slice of $length elements starting at position $offset from the Collection. + * Extracts a slice of $length elements starting at position $offset from the Collection. * * If $length is null it returns all elements from $offset to the end of the Collection. * Keys have to be preserved by this method. Calling this method will only return the * selected slice and NOT change the elements contained in the collection slice is called on. * - * @param int $offset - * @param int $length + * @param int $offset The offset to start from. + * @param int|null $length The maximum number of elements to return, or null for no limit. + * * @return array */ function slice($offset, $length = null); diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php similarity index 78% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php index 3b05549..42929bd 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Criteria.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Criteria.php @@ -41,12 +41,12 @@ class Criteria const DESC = 'DESC'; /** - * @var \Doctrine\Common\Collections\ExpressionBuilder + * @var \Doctrine\Common\Collections\ExpressionBuilder|null */ private static $expressionBuilder; /** - * @var \Doctrine\Common\Collections\Expr\Expression + * @var \Doctrine\Common\Collections\Expr\Expression|null */ private $expression; @@ -56,12 +56,12 @@ class Criteria private $orderings; /** - * @var int + * @var int|null */ private $firstResult; /** - * @var int + * @var int|null */ private $maxResults; @@ -76,7 +76,7 @@ public static function create() } /** - * Return the expression builder. + * Returns the expression builder. * * @return \Doctrine\Common\Collections\ExpressionBuilder */ @@ -89,12 +89,12 @@ public static function expr() } /** - * Construct new criteria + * Construct a new Criteria. * * @param Expression $expression - * @param array $orderings - * @param int $firstResult - * @param int $maxResults + * @param array|null $orderings + * @param int|null $firstResult + * @param int|null $maxResults */ public function __construct(Expression $expression = null, array $orderings = null, $firstResult = null, $maxResults = null) { @@ -105,9 +105,10 @@ public function __construct(Expression $expression = null, array $orderings = nu } /** - * Set the where expression to evaluate when this criteria is searched for. + * Sets the where expression to evaluate when this Criteria is searched for. + * + * @param Expression $expression * - * @param Expression * @return Criteria */ public function where(Expression $expression) @@ -117,10 +118,11 @@ public function where(Expression $expression) } /** - * Append the where expression to evaluate when this criteria is searched for + * Appends the where expression to evaluate when this Criteria is searched for * using an AND with previous expression. * - * @param Expression + * @param Expression $expression + * * @return Criteria */ public function andWhere(Expression $expression) @@ -137,10 +139,11 @@ public function andWhere(Expression $expression) } /** - * Append the where expression to evaluate when this criteria is searched for + * Appends the where expression to evaluate when this Criteria is searched for * using an OR with previous expression. * - * @param Expression + * @param Expression $expression + * * @return Criteria */ public function orWhere(Expression $expression) @@ -157,7 +160,7 @@ public function orWhere(Expression $expression) } /** - * Get the expression attached to this criteria. + * Gets the expression attached to this Criteria. * * @return Expression|null */ @@ -167,7 +170,7 @@ public function getWhereExpression() } /** - * Get current orderings of this Criteria + * Gets the current orderings of this Criteria. * * @return array */ @@ -177,14 +180,15 @@ public function getOrderings() } /** - * Set the ordering of the result of this criteria. + * Sets 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 + * @param array $orderings + * * @return Criteria */ public function orderBy(array $orderings) @@ -194,9 +198,9 @@ public function orderBy(array $orderings) } /** - * Get current first result option of the critera. + * Gets the current first result option of this Criteria. * - * @return firstResult. + * @return int|null */ public function getFirstResult() { @@ -204,9 +208,10 @@ public function getFirstResult() } /** - * Set number of first result that this criteria should return. + * Set the number of first result that this Criteria should return. + * + * @param int|null $firstResult The value to set. * - * @param firstResult the value to set. * @return Criteria */ public function setFirstResult($firstResult) @@ -216,9 +221,9 @@ public function setFirstResult($firstResult) } /** - * Get maxResults. + * Gets maxResults. * - * @return maxResults. + * @return int|null */ public function getMaxResults() { @@ -226,9 +231,10 @@ public function getMaxResults() } /** - * Set maxResults. + * Sets maxResults. + * + * @param int|null $maxResults The value to set. * - * @param maxResults the value to set. * @return Criteria */ public function setMaxResults($maxResults) @@ -237,4 +243,3 @@ public function setMaxResults($maxResults) return $this; } } - diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php similarity index 80% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php index 06ccb04..78a0755 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ClosureExpressionVisitor.php @@ -26,27 +26,42 @@ * by {@ArrayCollection#select()}. * * @author Benjamin Eberlei - * @since 2.3 + * @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). + * Accesses the field of a given object. This field has to be public + * directly or indirectly (through an accessor get*, is*, or a magic + * method, __get, __call). * - * is*() is not supported. + * @param object $object + * @param string $field * * @return mixed */ - static public function getObjectFieldValue($object, $field) + public static function getObjectFieldValue($object, $field) { - $accessor = "get" . $field; + $accessors = array('get', 'is'); + + foreach ($accessors as $accessor) { + $accessor .= $field; + + if ( ! method_exists($object, $accessor)) { + continue; + } - if (method_exists($object, $accessor) || method_exists($object, '__call')) { return $object->$accessor(); } - if ($object instanceof \ArrayAccess) { + // __call should be triggered for get. + $accessor = $accessors[0] . $field; + + if (method_exists($object, '__call')) { + return $object->$accessor(); + } + + if ($object instanceof \ArrayAccess || is_array($object)) { return $object[$field]; } @@ -54,15 +69,15 @@ static public function getObjectFieldValue($object, $field) } /** - * Helper for sorting arrays of objects based on multiple fields + - * orientations. + * Helper for sorting arrays of objects based on multiple fields + orientations. * - * @param string $name - * @param int $orientation - * @param Closure $next - * @return Closure + * @param string $name + * @param int $orientation + * @param \Closure $next + * + * @return \Closure */ - static public function sortByField($name, $orientation = 1, \Closure $next = null) + public static function sortByField($name, $orientation = 1, \Closure $next = null) { if (!$next) { $next = function() { @@ -132,6 +147,11 @@ public function walkComparison(Comparison $comparison) return ! in_array(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); }; + case Comparison::CONTAINS: + return function ($object) use ($field, $value) { + return false !== strpos(ClosureExpressionVisitor::getObjectFieldValue($object, $field), $value); + }; + default: throw new \RuntimeException("Unknown comparison operator: " . $comparison->getOperator()); } @@ -168,6 +188,11 @@ public function walkCompositeExpression(CompositeExpression $expr) } } + /** + * @param array $expressions + * + * @return callable + */ private function andExpressions($expressions) { return function ($object) use ($expressions) { @@ -180,6 +205,11 @@ private function andExpressions($expressions) }; } + /** + * @param array $expressions + * + * @return callable + */ private function orExpressions($expressions) { return function ($object) use ($expressions) { @@ -192,4 +222,3 @@ private function orExpressions($expressions) }; } } - diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php similarity index 73% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php index 29cfcff..641feec 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Comparison.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Comparison.php @@ -23,24 +23,41 @@ * Comparison of a field with a value by the given operator. * * @author Benjamin Eberlei - * @since 2.3 + * @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'; + const EQ = '='; + const NEQ = '<>'; + const LT = '<'; + const LTE = '<='; + const GT = '>'; + const GTE = '>='; + const IS = 'IS'; + const IN = 'IN'; + const NIN = 'NIN'; + const CONTAINS = 'CONTAINS'; + /** + * @var string + */ private $field; + + /** + * @var string + */ private $op; + + /** + * @var Value + */ private $value; + /** + * @param string $field + * @param string $operator + * @param mixed $value + */ public function __construct($field, $operator, $value) { if ( ! ($value instanceof Value)) { @@ -52,24 +69,35 @@ public function __construct($field, $operator, $value) $this->value = $value; } + /** + * @return string + */ public function getField() { return $this->field; } + /** + * @return Value + */ public function getValue() { return $this->value; } + /** + * @return string + */ public function getOperator() { return $this->op; } + /** + * {@inheritDoc} + */ 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/collections/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php similarity index 86% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php index fe917cf..3613c02 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/CompositeExpression.php @@ -23,16 +23,29 @@ * Expression of Expressions combined by AND or OR operation. * * @author Benjamin Eberlei - * @since 2.3 + * @since 2.3 */ class CompositeExpression implements Expression { const TYPE_AND = 'AND'; const TYPE_OR = 'OR'; + /** + * @var string + */ private $type; + + /** + * @var Expression[] + */ private $expressions = array(); + /** + * @param string $type + * @param array $expressions + * + * @throws \RuntimeException + */ public function __construct($type, array $expressions) { $this->type = $type; @@ -50,7 +63,7 @@ public function __construct($type, array $expressions) } /** - * Return the list of expressions nested in this composite. + * Returns the list of expressions nested in this composite. * * @return Expression[] */ @@ -59,14 +72,19 @@ public function getExpressionList() return $this->expressions; } + /** + * @return string + */ public function getType() { return $this->type; } + /** + * {@inheritDoc} + */ 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/collections/lib/Doctrine/Common/Collections/Expr/Expression.php similarity index 93% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Expression.php index b0762ad..68db767 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Expression.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Expression.php @@ -26,6 +26,10 @@ */ interface Expression { + /** + * @param ExpressionVisitor $visitor + * + * @return mixed + */ public function visit(ExpressionVisitor $visitor); } - diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php similarity index 86% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php index 5e69b98..080afdc 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/ExpressionVisitor.php @@ -28,7 +28,7 @@ abstract class ExpressionVisitor { /** - * Convert a comparison expression into the target query language output + * Converts a comparison expression into the target query language output. * * @param Comparison $comparison * @@ -37,7 +37,7 @@ abstract public function walkComparison(Comparison $comparison); /** - * Convert a value expression into the target query language part. + * Converts a value expression into the target query language part. * * @param Value $value * @@ -46,7 +46,7 @@ abstract public function walkValue(Value $value); /** - * Convert a composite expression into the target query language output + * Converts a composite expression into the target query language output. * * @param CompositeExpression $expr * @@ -55,11 +55,13 @@ abstract public function walkCompositeExpression(CompositeExpression $expr); /** - * Dispatch walking an expression to the appropriate handler. + * Dispatches walking an expression to the appropriate handler. * - * @param Expression + * @param Expression $expr * * @return mixed + * + * @throws \RuntimeException */ public function dispatch(Expression $expr) { @@ -78,4 +80,3 @@ public function dispatch(Expression $expr) } } } - diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Value.php similarity index 90% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Value.php index f0df11a..7f6e831 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Expr/Value.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Expr/Value.php @@ -21,21 +21,32 @@ class Value implements Expression { + /** + * @var mixed + */ private $value; + /** + * @param mixed $value + */ public function __construct($value) { $this->value = $value; } + /** + * @return mixed + */ public function getValue() { return $this->value; } + /** + * {@inheritDoc} + */ 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/collections/lib/Doctrine/Common/Collections/ExpressionBuilder.php similarity index 84% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ExpressionBuilder.php index b53f0cd..2bd7eaa 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ExpressionBuilder.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/ExpressionBuilder.php @@ -1,9 +1,9 @@ - * @since 2.3 + * @since 2.3 */ class ExpressionBuilder { /** + * @param mixed $x + * * @return CompositeExpression */ public function andX($x = null) @@ -40,6 +42,8 @@ public function andX($x = null) } /** + * @param mixed $x + * * @return CompositeExpression */ public function orX($x = null) @@ -49,7 +53,7 @@ public function orX($x = null) /** * @param string $field - * @param mixed $value + * @param mixed $value * * @return Comparison */ @@ -60,7 +64,7 @@ public function eq($field, $value) /** * @param string $field - * @param mixed $value + * @param mixed $value * * @return Comparison */ @@ -71,7 +75,7 @@ public function gt($field, $value) /** * @param string $field - * @param mixed $value + * @param mixed $value * * @return Comparison */ @@ -82,7 +86,7 @@ public function lt($field, $value) /** * @param string $field - * @param mixed $value + * @param mixed $value * * @return Comparison */ @@ -93,7 +97,7 @@ public function gte($field, $value) /** * @param string $field - * @param mixed $value + * @param mixed $value * * @return Comparison */ @@ -104,7 +108,7 @@ public function lte($field, $value) /** * @param string $field - * @param mixed $value + * @param mixed $value * * @return Comparison */ @@ -115,7 +119,6 @@ public function neq($field, $value) /** * @param string $field - * @param mixed $value * * @return Comparison */ @@ -126,7 +129,7 @@ public function isNull($field) /** * @param string $field - * @param mixed $value + * @param mixed $values * * @return Comparison */ @@ -137,7 +140,7 @@ public function in($field, array $values) /** * @param string $field - * @param mixed $value + * @param mixed $values * * @return Comparison */ @@ -145,5 +148,15 @@ public function notIn($field, array $values) { return new Comparison($field, Comparison::NIN, new Value($values)); } -} + /** + * @param string $field + * @param mixed $value + * + * @return Comparison + */ + public function contains($field, $value) + { + return new Comparison($field, Comparison::CONTAINS, new Value($value)); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Selectable.php similarity index 92% rename from core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php rename to core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Selectable.php index 675d6ea..401d46e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/Selectable.php +++ b/core/vendor/doctrine/collections/lib/Doctrine/Common/Collections/Selectable.php @@ -32,17 +32,17 @@ * EntityManager or Repositories. * * @author Benjamin Eberlei - * @since 2.3 + * @since 2.3 */ interface Selectable { /** - * Select all elements from a selectable that match the expression and - * return a new collection containing these elements. + * Selects all elements from a selectable that match the expression and + * returns a new collection containing these elements. * * @param Criteria $criteria + * * @return Collection */ function matching(Criteria $criteria); } - diff --git a/core/vendor/doctrine/collections/phpunit.xml.dist b/core/vendor/doctrine/collections/phpunit.xml.dist new file mode 100644 index 0000000..36968e9 --- /dev/null +++ b/core/vendor/doctrine/collections/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + ./tests/Doctrine/ + + + + + + ./lib/Doctrine/ + + + + + + performance + + + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php similarity index 82% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php rename to core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php index e40afba..b640043 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.php +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ClosureExpressionVisitorTest.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,6 +36,20 @@ public function setUp() $this->builder = new ExpressionBuilder(); } + public function testGetObjectFieldValueIsAccessor() + { + $object = new TestObject(1, 2, true); + + $this->assertTrue($this->visitor->getObjectFieldValue($object, 'baz')); + } + + public function testGetObjectFieldValueMagicCallMethod() + { + $object = new TestObject(1, 2, true, 3); + + $this->assertEquals(3, $this->visitor->getObjectFieldValue($object, 'qux')); + } + public function testWalkEqualsComparison() { $closure = $this->visitor->walkComparison($this->builder->eq("foo", 1)); @@ -106,6 +120,14 @@ public function testWalkNotInComparison() $this->assertTrue($closure(new TestObject(4))); } + public function testWalkContainsComparison() + { + $closure = $this->visitor->walkComparison($this->builder->contains('foo', 'hello')); + + $this->assertTrue($closure(new TestObject('hello world'))); + $this->assertFalse($closure(new TestObject('world'))); + } + public function testWalkAndCompositeExpression() { $closure = $this->visitor->walkCompositeExpression( @@ -172,17 +194,35 @@ public function testSortDelegate() $this->assertEquals("b", $objects[1]->getBar()); $this->assertEquals("c", $objects[2]->getBar()); } + + public function testArrayComparison() + { + $closure = $this->visitor->walkComparison($this->builder->eq("foo", 42)); + + $this->assertTrue($closure(array('foo' => 42))); + } } class TestObject { private $foo; private $bar; + private $baz; + private $qux; - public function __construct($foo = null, $bar = null) + public function __construct($foo = null, $bar = null, $baz = null, $qux = null) { $this->foo = $foo; $this->bar = $bar; + $this->baz = $baz; + $this->qux = $qux; + } + + public function __call($name, $arguments) + { + if ('getqux' === $name) { + return $this->qux; + } } public function getFoo() @@ -194,5 +234,10 @@ public function getBar() { return $this->bar; } + + public function isBaz() + { + return $this->baz; + } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php similarity index 95% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php rename to core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php index 280efa3..d98246c 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CollectionTest.php +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CollectionTest.php @@ -248,4 +248,17 @@ public function testMatchingSlice() $this->assertEquals(1, count($col)); $this->assertEquals('baz', $col[0]->foo); } + + public function testCanRemoveNullValuesByKey() + { + $this->_coll->add(null); + $this->_coll->remove(0); + $this->assertTrue($this->_coll->isEmpty()); + } + + public function testCanVerifyExistingKeysWithNullValues() + { + $this->_coll->set('key', null); + $this->assertTrue($this->_coll->containsKey('key')); + } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php similarity index 100% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php rename to core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/CriteriaTest.php diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php similarity index 92% rename from core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php rename to core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php index 68896b3..23dfc21 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/Common/Collections/ExpressionBuilderTest.php @@ -110,5 +110,13 @@ public function testIsNull() $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); $this->assertEquals(Comparison::IS, $expr->getOperator()); } + + public function testContains() + { + $expr = $this->builder->contains("a", "b"); + + $this->assertInstanceOf("Doctrine\Common\Collections\Expr\Comparison", $expr); + $this->assertEquals(Comparison::CONTAINS, $expr->getOperator()); + } } diff --git a/core/vendor/doctrine/collections/tests/Doctrine/Tests/DoctrineTestCase.php b/core/vendor/doctrine/collections/tests/Doctrine/Tests/DoctrineTestCase.php new file mode 100644 index 0000000..e8323d2 --- /dev/null +++ b/core/vendor/doctrine/collections/tests/Doctrine/Tests/DoctrineTestCase.php @@ -0,0 +1,10 @@ +. */ diff --git a/core/vendor/doctrine/common/build.xml b/core/vendor/doctrine/common/build.xml index 71a9a50..9d9100d 100644 --- a/core/vendor/doctrine/common/build.xml +++ b/core/vendor/doctrine/common/build.xml @@ -46,7 +46,7 @@ - LGPL + MIT - diff --git a/core/vendor/doctrine/common/composer.json b/core/vendor/doctrine/common/composer.json index c87258d..24f9a2c 100644 --- a/core/vendor/doctrine/common/composer.json +++ b/core/vendor/doctrine/common/composer.json @@ -13,14 +13,19 @@ {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.2", + "doctrine/inflector": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/lexer": "1.*", + "doctrine/annotations": "1.*" }, "autoload": { - "psr-0": { "Doctrine\\Common": "lib/" } + "psr-0": { "Doctrine\\Common\\": "lib/" } }, "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "2.4.x-dev" } } } diff --git a/core/vendor/doctrine/common/composer.lock b/core/vendor/doctrine/common/composer.lock new file mode 100644 index 0000000..1ed8a6b --- /dev/null +++ b/core/vendor/doctrine/common/composer.lock @@ -0,0 +1,322 @@ +{ + "hash": "f763db6a8f5bcaff6e51ae516283a4c9", + "packages": [ + { + "name": "doctrine/annotations", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/annotations/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "doctrine/lexer": "1.*" + }, + "require-dev": { + "doctrine/cache": "1.*" + }, + "time": "2013-01-12 19:23:32", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "parser", + "docblock" + ] + }, + { + "name": "doctrine/cache", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/cache/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-01-10 22:43:46", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Cache\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ] + }, + { + "name": "doctrine/collections", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/collections/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-01-12 16:36:50", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "collections", + "iterator", + "array" + ] + }, + { + "name": "doctrine/inflector", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/inflector/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-01-10 21:49:15", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Inflector\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "string", + "inflection", + "singuarlize", + "pluarlize" + ] + }, + { + "name": "doctrine/lexer", + "version": "v1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "v1.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/doctrine/lexer/archive/v1.0.zip", + "reference": "v1.0", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2013-01-12 18:59:04", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com", + "homepage": "http://www.instaclick.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh", + "role": "Developer of wrapped JMSSerializerBundle" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "parser", + "lexer" + ] + } + ], + "packages-dev": null, + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": [ + + ] +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php index 45024e1..632805e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/ClassLoader.php @@ -34,22 +34,30 @@ class ClassLoader { /** - * @var string PHP file extension + * PHP file extension. + * + * @var string */ protected $fileExtension = '.php'; /** - * @var string Current namespace + * Current namespace. + * + * @var string|null */ protected $namespace; /** - * @var string Current include path + * Current include path. + * + * @var string|null */ protected $includePath; /** - * @var string PHP namespace separator + * PHP namespace separator. + * + * @var string */ protected $namespaceSeparator = '\\'; @@ -61,8 +69,8 @@ class ClassLoader * If neither a namespace nor an include path is given, the ClassLoader will * be responsible for loading all classes, thereby relying on the PHP include_path. * - * @param string $ns The namespace of the classes to load. - * @param string $includePath The base include path to use. + * @param string|null $ns The namespace of the classes to load. + * @param string|null $includePath The base include path to use. */ public function __construct($ns = null, $includePath = null) { @@ -74,6 +82,8 @@ public function __construct($ns = null, $includePath = null) * Sets the namespace separator used by classes in the namespace of this ClassLoader. * * @param string $sep The separator to use. + * + * @return void */ public function setNamespaceSeparator($sep) { @@ -93,7 +103,9 @@ public function getNamespaceSeparator() /** * Sets the base include path for all class files in the namespace of this ClassLoader. * - * @param string $includePath + * @param string|null $includePath + * + * @return void */ public function setIncludePath($includePath) { @@ -103,7 +115,7 @@ public function setIncludePath($includePath) /** * Gets the base include path for all class files in the namespace of this ClassLoader. * - * @return string + * @return string|null */ public function getIncludePath() { @@ -114,6 +126,8 @@ public function getIncludePath() * Sets the file extension of class files in the namespace of this ClassLoader. * * @param string $fileExtension + * + * @return void */ public function setFileExtension($fileExtension) { @@ -132,6 +146,8 @@ public function getFileExtension() /** * Registers this ClassLoader on the SPL autoload stack. + * + * @return void */ public function register() { @@ -140,6 +156,8 @@ public function register() /** * Removes this ClassLoader from the SPL autoload stack. + * + * @return void */ public function unregister() { @@ -150,7 +168,7 @@ public function unregister() * Loads the given class or interface. * * @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) @@ -171,6 +189,7 @@ public function loadClass($className) * the given name. * * @param string $className The fully-qualified name of the class. + * * @return boolean TRUE if this ClassLoader can load the class, FALSE otherwise. */ public function canLoadClass($className) @@ -182,7 +201,7 @@ public function canLoadClass($className) $file = str_replace($this->namespaceSeparator, DIRECTORY_SEPARATOR, $className) . $this->fileExtension; if ($this->includePath !== null) { - return file_exists($this->includePath . DIRECTORY_SEPARATOR . $file); + return is_file($this->includePath . DIRECTORY_SEPARATOR . $file); } return (false !== stream_resolve_include_path($file)); @@ -207,6 +226,7 @@ public function canLoadClass($className) * these responsibilities. * * @param string $className The fully-qualified name of the class. + * * @return boolean TRUE if the class exists as per the definition given above, FALSE otherwise. */ public static function classExists($className) @@ -235,9 +255,13 @@ public static function classExists($className) } else if (is_string($loader) && $loader($className)) { // "MyClass::loadClass" return true; } + + if (class_exists($className, false) || interface_exists($className, false)) { + return true; + } } - return class_exists($className, false) || interface_exists($className, false); + return false; } /** @@ -245,6 +269,7 @@ public static function classExists($className) * for (and is able to load) the class with the given name. * * @param string $className The name of the class. + * * @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/CommonException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php index 6db7675..2a1a08e 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/CommonException.php @@ -20,9 +20,10 @@ namespace Doctrine\Common; /** - * Base exception class for package Doctrine\Common - * @author heinrich + * Base exception class for package Doctrine\Common. * + * @author heinrich */ -class CommonException extends \Exception { +class CommonException extends \Exception +{ } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php index 20d065e..8cd02c9 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Comparable.php @@ -17,22 +17,20 @@ * . */ - namespace Doctrine\Common; /** * Comparable interface that allows to compare two value objects to each other for similarity. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.com - * @since 2.2 - * @author Benjamin Eberlei - * @author Guilherme Blanco + * @link www.doctrine-project.org + * @since 2.2 + * @author Benjamin Eberlei + * @author Guilherme Blanco */ interface Comparable { /** - * Compare the current object to the passed $other. + * Compares the current object to the passed $other. * * Returns 0 if they are semantically equal, 1 if the other object * is less than the current one, or -1 if its more than the current one. @@ -46,4 +44,3 @@ */ 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 a87eee8..75506e6 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventArgs.php @@ -1,7 +1,5 @@ - * @author Jonathan Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ class EventArgs { /** - * @var EventArgs Single instance of EventArgs + * Single instance of EventArgs. + * + * @var EventArgs */ private static $_emptyEventArgsInstance; @@ -50,10 +48,12 @@ class EventArgs * like this: EventManager::dispatchEvent('eventname'); * * The benefit from this is that only one empty instance is instantiated and shared - * (otherwise there would be instances for every dispatched in the abovementioned form) + * (otherwise there would be instances for every dispatched in the abovementioned form). * * @see EventManager::dispatchEvent + * * @link http://msdn.microsoft.com/en-us/library/system.eventargs.aspx + * * @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 25aac44..fbbd2a8 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventManager.php @@ -1,7 +1,5 @@ - * @author Jonathan Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ class EventManager { @@ -47,10 +43,11 @@ class EventManager /** * Dispatches an event to all registered listeners. * - * @param string $eventName The name of the event to dispatch. The name of the event is - * the name of the method that is invoked on listeners. - * @param EventArgs $eventArgs The event arguments to pass to the event handlers/listeners. - * If not supplied, the single empty EventArgs instance is used. + * @param string $eventName The name of the event to dispatch. The name of the event is + * the name of the method that is invoked on listeners. + * @param EventArgs|null $eventArgs The event arguments to pass to the event handlers/listeners. + * If not supplied, the single empty EventArgs instance is used. + * * @return boolean */ public function dispatchEvent($eventName, EventArgs $eventArgs = null) @@ -67,7 +64,8 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null) /** * Gets the listeners of a specific event or all listeners. * - * @param string $event The name of the event. + * @param string|null $event The name of the event. + * * @return array The event listeners for the specified event, or all event listeners. */ public function getListeners($event = null) @@ -79,6 +77,7 @@ public function getListeners($event = null) * Checks whether an event has any registered listeners. * * @param string $event + * * @return boolean TRUE if the specified event has any listeners, FALSE otherwise. */ public function hasListeners($event) @@ -89,8 +88,10 @@ public function hasListeners($event) /** * Adds an event listener that listens on the specified events. * - * @param string|array $events The event(s) to listen on. - * @param object $listener The listener object. + * @param string|array $events The event(s) to listen on. + * @param object $listener The listener object. + * + * @return void */ public function addEventListener($events, $listener) { @@ -108,7 +109,9 @@ public function addEventListener($events, $listener) * Removes an event listener from the specified events. * * @param string|array $events - * @param object $listener + * @param object $listener + * + * @return void */ public function removeEventListener($events, $listener) { @@ -128,20 +131,24 @@ public function removeEventListener($events, $listener) * interested in and added as a listener for these events. * * @param \Doctrine\Common\EventSubscriber $subscriber The subscriber. + * + * @return void */ public function addEventSubscriber(EventSubscriber $subscriber) { $this->addEventListener($subscriber->getSubscribedEvents(), $subscriber); } - + /** * 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. + * + * @return void */ 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 1458791..55d0f7d 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/EventSubscriber.php @@ -1,7 +1,5 @@ - * @author Jonathan Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ interface EventSubscriber { @@ -41,5 +38,5 @@ * * @return array */ - function getSubscribedEvents(); + public function getSubscribedEvents(); } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php index 8e2554c..0aa07f8 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Lexer.php @@ -19,248 +19,19 @@ namespace Doctrine\Common; +use Doctrine\Common\Lexer\AbstractLexer; + /** * Base class for writing simple lexers, i.e. for creating small DSLs. * - * @since 2.0 - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @todo Rename: AbstractLexer + * Lexer moved into its own Component Doctrine\Common\Lexer. This class + * only stays for being BC. + * + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ -abstract class Lexer +abstract class Lexer extends AbstractLexer { - /** - * @var array Array of scanned tokens - */ - private $tokens = array(); - - /** - * @var integer Current lexer position in input string - */ - private $position = 0; - - /** - * @var integer Current peek of current lexer position - */ - private $peek = 0; - - /** - * @var array The next token in the input. - */ - public $lookahead; - - /** - * @var array The last matched/seen token. - */ - public $token; - - /** - * Sets the input data to be tokenized. - * - * The Lexer is immediately reset and the new input tokenized. - * Any unprocessed tokens from any previous input are lost. - * - * @param string $input The input to be tokenized. - */ - public function setInput($input) - { - $this->tokens = array(); - $this->reset(); - $this->scan($input); - } - - /** - * Resets the lexer. - */ - public function reset() - { - $this->lookahead = null; - $this->token = null; - $this->peek = 0; - $this->position = 0; - } - - /** - * Resets the peek pointer to 0. - */ - public function resetPeek() - { - $this->peek = 0; - } - - /** - * Resets the lexer position on the input to the given position. - * - * @param integer $position Position to place the lexical scanner - */ - public function resetPosition($position = 0) - { - $this->position = $position; - } - - /** - * Checks whether a given token matches the current lookahead. - * - * @param integer|string $token - * @return boolean - */ - public function isNextToken($token) - { - return null !== $this->lookahead && $this->lookahead['type'] === $token; - } - - /** - * Checks whether any of the given tokens matches the current lookahead - * - * @param array $tokens - * @return boolean - */ - public function isNextTokenAny(array $tokens) - { - return null !== $this->lookahead && in_array($this->lookahead['type'], $tokens, true); - } - - /** - * Moves to the next token in the input string. - * - * A token is an associative array containing three items: - * - 'value' : the string value of the token in the input string - * - 'type' : the type of the token (identifier, numeric, string, input - * parameter, none) - * - 'position' : the position of the token in the input string - * - * @return array|null the next token; null if there is no more tokens left - */ - public function moveNext() - { - $this->peek = 0; - $this->token = $this->lookahead; - $this->lookahead = (isset($this->tokens[$this->position])) - ? $this->tokens[$this->position++] : null; - - return $this->lookahead !== null; - } - - /** - * Tells the lexer to skip input tokens until it sees a token with the given value. - * - * @param string $type The token type to skip until. - */ - public function skipUntil($type) - { - while ($this->lookahead !== null && $this->lookahead['type'] !== $type) { - $this->moveNext(); - } - } - - /** - * Checks if given value is identical to the given token - * - * @param mixed $value - * @param integer $token - * @return boolean - */ - public function isA($value, $token) - { - return $this->getType($value) === $token; - } - - /** - * Moves the lookahead token forward. - * - * @return array | null The next token or NULL if there are no more tokens ahead. - */ - public function peek() - { - if (isset($this->tokens[$this->position + $this->peek])) { - return $this->tokens[$this->position + $this->peek++]; - } else { - return null; - } - } - - /** - * Peeks at the next token, returns it and immediately resets the peek. - * - * @return array|null The next token or NULL if there are no more tokens ahead. - */ - public function glimpse() - { - $peek = $this->peek(); - $this->peek = 0; - return $peek; - } - - /** - * Scans the input string for tokens. - * - * @param string $input a query string - */ - protected function scan($input) - { - static $regex; - - if ( ! isset($regex)) { - $regex = '/(' . implode(')|(', $this->getCatchablePatterns()) . ')|' - . implode('|', $this->getNonCatchablePatterns()) . '/i'; - } - - $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE; - $matches = preg_split($regex, $input, -1, $flags); - - foreach ($matches as $match) { - // Must remain before 'value' assignment since it can change content - $type = $this->getType($match[0]); - - $this->tokens[] = array( - 'value' => $match[0], - 'type' => $type, - 'position' => $match[1], - ); - } - } - - /** - * Gets the literal for a given token. - * - * @param integer $token - * @return string - */ - public function getLiteral($token) - { - $className = get_class($this); - $reflClass = new \ReflectionClass($className); - $constants = $reflClass->getConstants(); - - foreach ($constants as $name => $value) { - if ($value === $token) { - return $className . '::' . $name; - } - } - - return $token; - } - - /** - * Lexical catchable patterns. - * - * @return array - */ - abstract protected function getCatchablePatterns(); - - /** - * Lexical non-catchable patterns. - * - * @return array - */ - abstract protected function getNonCatchablePatterns(); - - /** - * Retrieve token type. Also processes the token value if necessary. - * - * @param string $value - * @return integer - */ - abstract protected function getType(&$value); } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php b/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php index e32c0b9..e25e999 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/NotifyPropertyChanged.php @@ -1,7 +1,5 @@ - * @author Jonathan Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ interface NotifyPropertyChanged { @@ -39,7 +35,8 @@ * Adds a listener that wants to be notified about property changes. * * @param PropertyChangedListener $listener + * + * @return void */ - function addPropertyChangedListener(PropertyChangedListener $listener); + public function addPropertyChangedListener(PropertyChangedListener $listener); } - 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 94fcd05..15b5aa3 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/AbstractManagerRegistry.php @@ -1,5 +1,4 @@ - * @author Benjamin Eberlei - * @author Lukas Kahwe Smith + * @link www.doctrine-project.org + * @since 2.2 + * @author Fabien Potencier + * @author Benjamin Eberlei + * @author Lukas Kahwe Smith */ abstract class AbstractManagerRegistry implements ManagerRegistry { @@ -65,11 +63,11 @@ private $proxyInterfaceName; /** - * Constructor + * Constructor. * * @param string $name - * @param array $connections - * @param array $managers + * @param array $connections + * @param array $managers * @param string $defaultConnection * @param string $defaultManager * @param string $proxyInterfaceName @@ -85,27 +83,29 @@ public function __construct($name, array $connections, array $managers, $default } /** - * Fetches/creates the given services + * Fetches/creates the given services. + * + * A service in this context is connection or a manager instance. * - * A service in this context is connection or a manager instance + * @param string $name The name of the service. * - * @param string $name name of the service - * @return object instance of the given service + * @return object The instance of the given service. */ abstract protected function getService($name); /** - * Resets the given services + * Resets the given services. + * + * A service in this context is connection or a manager instance. * - * A service in this context is connection or a manager instance + * @param string $name The name of the service. * - * @param string $name name of the service * @return void */ abstract protected function resetService($name); /** - * Get the name of the registry + * Gets the name of the registry. * * @return string */ 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 7d6f0cf..7c25e98 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ConnectionRegistry.php @@ -22,42 +22,41 @@ /** * Contract covering connection for a Doctrine persistence layer ManagerRegistry class to implement. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.2 - * @author Fabien Potencier - * @author Benjamin Eberlei - * @author Lukas Kahwe Smith + * @link www.doctrine-project.org + * @since 2.2 + * @author Fabien Potencier + * @author Benjamin Eberlei + * @author Lukas Kahwe Smith */ interface ConnectionRegistry { /** * Gets the default connection name. * - * @return string The default connection name + * @return string The default connection name. */ - function getDefaultConnectionName(); + public function getDefaultConnectionName(); /** * Gets the named connection. * - * @param string $name The connection name (null for the default one) + * @param string $name The connection name (null for the default one). * * @return object */ - function getConnection($name = null); + public function getConnection($name = null); /** - * Gets an array of all registered connections + * Gets an array of all registered connections. * - * @return array An array of Connection instances + * @return array An array of Connection instances. */ - function getConnections(); + public function getConnections(); /** * Gets all connection names. * - * @return array An array of connection names + * @return array An array of connection names. */ - function getConnectionNames(); + public function getConnectionNames(); } 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 2fb7c47..52f41c0 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 @@ -15,7 +15,7 @@ * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * . -*/ + */ namespace Doctrine\Common\Persistence\Event; @@ -41,32 +41,44 @@ class LifecycleEventArgs extends EventArgs /** * @var object */ - private $entity; + private $object; /** - * Constructor + * Constructor. * - * @param object $entity + * @param object $object * @param ObjectManager $objectManager */ - public function __construct($entity, ObjectManager $objectManager) + public function __construct($object, ObjectManager $objectManager) { - $this->entity = $entity; + $this->object = $object; $this->objectManager = $objectManager; } /** - * Retrieve associated Entity. + * Retrieves the associated entity. + * + * @deprecated * * @return object */ public function getEntity() { - return $this->entity; + return $this->object; + } + + /** + * Retrieves the associated object. + * + * @return object + */ + public function getObject() + { + return $this->object; } /** - * Retrieve associated ObjectManager. + * Retrieves the associated ObjectManager. * * @return ObjectManager */ 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 c014d73..07770bb 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 @@ -54,7 +54,7 @@ public function __construct(ClassMetadata $classMetadata, ObjectManager $objectM } /** - * Retrieve associated ClassMetadata. + * Retrieves the associated ClassMetadata. * * @return ClassMetadata */ @@ -64,7 +64,7 @@ public function getClassMetadata() } /** - * Retrieve associated ObjectManager. + * Retrieves the associated ObjectManager. * * @return ObjectManager */ @@ -73,4 +73,3 @@ public function getObjectManager() return $this->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 f139365..5527d4d 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 @@ -15,22 +15,22 @@ * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * . -*/ + */ namespace Doctrine\Common\Persistence\Event; +use Doctrine\Common\EventArgs; use Doctrine\Common\Persistence\ObjectManager; /** * Provides event arguments for the preFlush event. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.2 - * @author Roman Borschel - * @author Benjamin Eberlei + * @link www.doctrine-project.org + * @since 2.2 + * @author Roman Borschel + * @author Benjamin Eberlei */ -class ManagerEventArgs extends \Doctrine\Common\EventArgs +class ManagerEventArgs extends EventArgs { /** * @var ObjectManager @@ -48,7 +48,7 @@ public function __construct(ObjectManager $objectManager) } /** - * Retrieve associated ObjectManager. + * Retrieves the associated ObjectManager. * * @return ObjectManager */ 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 18b6554..b78bad9 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 @@ -19,16 +19,18 @@ namespace Doctrine\Common\Persistence\Event; +use Doctrine\Common\EventArgs; +use Doctrine\Common\Persistence\ObjectManager; + /** * Provides event arguments for the onClear event. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.2 - * @author Roman Borschel - * @author Benjamin Eberlei + * @link www.doctrine-project.org + * @since 2.2 + * @author Roman Borschel + * @author Benjamin Eberlei */ -class OnClearEventArgs extends \Doctrine\Common\EventArgs +class OnClearEventArgs extends EventArgs { /** * @var \Doctrine\Common\Persistence\ObjectManager @@ -36,15 +38,15 @@ class OnClearEventArgs extends \Doctrine\Common\EventArgs private $objectManager; /** - * @var string + * @var string|null */ private $entityClass; /** * Constructor. * - * @param \Doctrine\Common\Persistence\ObjectManager $objectManager - * @param string $entityClass Optional entity class + * @param ObjectManager $objectManager The object manager. + * @param string|null $entityClass The optional entity class. */ public function __construct($objectManager, $entityClass = null) { @@ -53,7 +55,7 @@ public function __construct($objectManager, $entityClass = null) } /** - * Retrieve associated ObjectManager. + * Retrieves the associated ObjectManager. * * @return \Doctrine\Common\Persistence\ObjectManager */ @@ -63,9 +65,9 @@ public function getObjectManager() } /** - * Name of the entity class that is cleared, or empty if all are cleared. + * Returns the name of the entity class that is cleared, or null if all are cleared. * - * @return string + * @return string|null */ public function getEntityClass() { @@ -73,7 +75,7 @@ public function getEntityClass() } /** - * Check if event clears all entities. + * Returns whether this event clears all entities. * * @return bool */ 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 86ac819..d34de84 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 @@ -19,8 +19,8 @@ namespace Doctrine\Common\Persistence\Event; -use Doctrine\Common\EventArgs, - Doctrine\Common\Persistence\ObjectManager; +use Doctrine\Common\EventArgs; +use Doctrine\Common\Persistence\ObjectManager; /** * Class that holds event arguments for a preUpdate event. @@ -40,9 +40,9 @@ class PreUpdateEventArgs extends LifecycleEventArgs /** * Constructor. * - * @param object $entity + * @param object $entity * @param ObjectManager $objectManager - * @param array $changeSet + * @param array $changeSet */ public function __construct($entity, ObjectManager $objectManager, array &$changeSet) { @@ -52,7 +52,7 @@ public function __construct($entity, ObjectManager $objectManager, array &$chang } /** - * Retrieve entity changeset. + * Retrieves the entity changeset. * * @return array */ @@ -62,7 +62,7 @@ public function getEntityChangeSet() } /** - * Check if field has a changeset. + * Checks if field has a changeset. * * @param string $field * @@ -74,9 +74,10 @@ public function hasChangedField($field) } /** - * Get the old value of the changeset of the changed field. + * Gets the old value of the changeset of the changed field. + * + * @param string $field * - * @param string $field * @return mixed */ public function getOldValue($field) @@ -87,9 +88,10 @@ public function getOldValue($field) } /** - * Get the new value of the changeset of the changed field. + * Gets the new value of the changeset of the changed field. + * + * @param string $field * - * @param string $field * @return mixed */ public function getNewValue($field) @@ -100,10 +102,12 @@ public function getNewValue($field) } /** - * Set the new value of this field. + * Sets the new value of this field. * * @param string $field - * @param mixed $value + * @param mixed $value + * + * @return void */ public function setNewValue($field, $value) { @@ -113,10 +117,12 @@ public function setNewValue($field, $value) } /** - * Assert the field exists in changeset. + * Asserts the field exists in changeset. * * @param string $field * + * @return void + * * @throws \InvalidArgumentException */ private function assertValidField($field) @@ -130,4 +136,3 @@ 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 bdb23bd..fce854b 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ManagerRegistry.php @@ -22,37 +22,36 @@ /** * Contract covering object managers for a Doctrine persistence layer ManagerRegistry class to implement. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.2 - * @author Fabien Potencier - * @author Benjamin Eberlei - * @author Lukas Kahwe Smith + * @link www.doctrine-project.org + * @since 2.2 + * @author Fabien Potencier + * @author Benjamin Eberlei + * @author Lukas Kahwe Smith */ interface ManagerRegistry extends ConnectionRegistry { /** * Gets the default object manager name. * - * @return string The default object manager name + * @return string The default object manager name. */ - function getDefaultManagerName(); + public function getDefaultManagerName(); /** * Gets a named object manager. * - * @param string $name The object manager name (null for the default one) + * @param string $name The object manager name (null for the default one). * * @return \Doctrine\Common\Persistence\ObjectManager */ - function getManager($name = null); + public function getManager($name = null); /** - * Gets an array of all registered object managers + * Gets an array of all registered object managers. * * @return \Doctrine\Common\Persistence\ObjectManager[] An array of ObjectManager instances */ - function getManagers(); + public function getManagers(); /** * Resets a named object manager. @@ -67,46 +66,46 @@ function getManagers(); * hold an obsolete reference. You can inject the registry instead * to avoid this problem. * - * @param string $name The object manager name (null for the default one) + * @param string|null $name The object manager name (null for the default one). * * @return \Doctrine\Common\Persistence\ObjectManager */ - function resetManager($name = null); + public function resetManager($name = null); /** * Resolves a registered namespace alias to the full namespace. * * This method looks for the alias in all registered object managers. * - * @param string $alias The alias + * @param string $alias The alias. * - * @return string The full namespace + * @return string The full namespace. */ - function getAliasNamespace($alias); + public function getAliasNamespace($alias); /** * Gets all connection names. * - * @return array An array of connection names + * @return array An array of connection names. */ - function getManagerNames(); + public function getManagerNames(); /** * Gets the ObjectRepository for an persistent object. * - * @param string $persistentObject The name of the persistent object. - * @param string $persistentManagerName The object manager name (null for the default one) + * @param string $persistentObject The name of the persistent object. + * @param string $persistentManagerName The object manager name (null for the default one). * * @return \Doctrine\Common\Persistence\ObjectRepository */ - function getRepository($persistentObject, $persistentManagerName = null); + public function getRepository($persistentObject, $persistentManagerName = null); /** * Gets the object manager associated with a given class. * - * @param string $class A persistent object class name + * @param string $class A persistent object class name. * * @return \Doctrine\Common\Persistence\ObjectManager|null */ - function getManagerForClass($class); + public function getManagerForClass($class); } 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 1ace1cc..01ad58f 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 @@ -19,21 +19,21 @@ namespace Doctrine\Common\Persistence\Mapping; -use Doctrine\Common\Cache\Cache, - Doctrine\Common\Util\ClassUtils; +use Doctrine\Common\Cache\Cache; +use Doctrine\Common\Util\ClassUtils; /** * The ClassMetadataFactory is used to create ClassMetadata objects that contain all the * metadata mapping informations of a class which describes how a class should be mapped * to a relational database. * - * This class was abstracted from the ORM ClassMetadataFactory + * This class was abstracted from the ORM ClassMetadataFactory. * - * @since 2.2 - * @author Benjamin Eberlei - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel + * @since 2.2 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ abstract class AbstractClassMetadataFactory implements ClassMetadataFactory { @@ -42,10 +42,10 @@ * * @var string */ - protected $cacheSalt = "\$CLASSMETADATA"; + protected $cacheSalt = '$CLASSMETADATA'; /** - * @var \Doctrine\Common\Cache\Cache + * @var \Doctrine\Common\Cache\Cache|null */ private $cacheDriver; @@ -60,14 +60,16 @@ protected $initialized = false; /** - * @var ReflectionService + * @var ReflectionService|null */ - private $reflectionService; + private $reflectionService = null; /** * Sets the cache driver used by the factory to cache ClassMetadata instances. * - * @param Doctrine\Common\Cache\Cache $cacheDriver + * @param \Doctrine\Common\Cache\Cache $cacheDriver + * + * @return void */ public function setCacheDriver(Cache $cacheDriver = null) { @@ -77,7 +79,7 @@ public function setCacheDriver(Cache $cacheDriver = null) /** * Gets the cache driver used by the factory to cache ClassMetadata instances. * - * @return Doctrine\Common\Cache\Cache + * @return \Doctrine\Common\Cache\Cache|null */ public function getCacheDriver() { @@ -85,7 +87,7 @@ public function getCacheDriver() } /** - * Return an array of all the loaded metadata currently in memory. + * Returns an array of all the loaded metadata currently in memory. * * @return array */ @@ -124,35 +126,38 @@ public function getAllMetadata() abstract protected function initialize(); /** - * Get the fully qualified class-name from the namespace alias. + * Gets the fully qualified class-name from the namespace alias. * * @param string $namespaceAlias * @param string $simpleClassName + * * @return string */ abstract protected function getFqcnFromAlias($namespaceAlias, $simpleClassName); /** - * Return the mapping driver implementation. + * Returns the mapping driver implementation. * * @return \Doctrine\Common\Persistence\Mapping\Driver\MappingDriver */ abstract protected function getDriver(); /** - * Wakeup reflection after ClassMetadata gets unserialized from cache. + * Wakes up reflection after ClassMetadata gets unserialized from cache. * - * @param ClassMetadata $class + * @param ClassMetadata $class * @param ReflectionService $reflService + * * @return void */ abstract protected function wakeupReflection(ClassMetadata $class, ReflectionService $reflService); /** - * Initialize Reflection after ClassMetadata was constructed. + * Initializes Reflection after ClassMetadata was constructed. * - * @param ClassMetadata $class + * @param ClassMetadata $class * @param ReflectionService $reflService + * * @return void */ abstract protected function initializeReflection(ClassMetadata $class, ReflectionService $reflService); @@ -160,10 +165,10 @@ public function getAllMetadata() /** * Checks whether the class metadata is an entity. * - * This method should false for mapped superclasses or - * embedded classes. + * This method should return false for mapped superclasses or embedded classes. * * @param ClassMetadata $class + * * @return boolean */ abstract protected function isEntity(ClassMetadata $class); @@ -172,6 +177,7 @@ public function getAllMetadata() * Gets the class metadata descriptor for a class. * * @param string $className The name of the class. + * * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata */ public function getMetadataFor($className) @@ -224,6 +230,7 @@ public function getMetadataFor($className) * Checks whether the factory has the metadata for a class loaded already. * * @param string $className + * * @return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise. */ public function hasMetadataFor($className) @@ -236,8 +243,10 @@ public function hasMetadataFor($className) * * NOTE: This is only useful in very special cases, like when generating proxy classes. * - * @param string $className + * @param string $className * @param ClassMetadata $class + * + * @return void */ public function setMetadataFor($className, $class) { @@ -245,10 +254,11 @@ public function setMetadataFor($className, $class) } /** - * Get array of parent classes for the given entity class + * Gets an array of parent classes for the given entity class. * * @param string $name - * @return array $parentClasses + * + * @return array */ protected function getParentClasses($name) { @@ -266,6 +276,12 @@ protected function getParentClasses($name) * Loads the metadata of the class in question and all it's ancestors whose metadata * is still not loaded. * + * Important: The class $name does not necesarily exist at this point here. + * Scenarios in a code-generation setup might have access to XML/YAML + * Mapping files without the actual PHP code existing here. That is why the + * {@see Doctrine\Common\Persistence\Mapping\ReflectionService} interface + * should be used for reflection. + * * @param string $name The name of the class for which the metadata should get loaded. * * @return array @@ -319,12 +335,14 @@ protected function loadMetadata($name) } /** - * Actually load the metadata from the underlying metadata + * Actually loads the metadata from the underlying metadata. * - * @param ClassMetadata $class + * @param ClassMetadata $class * @param ClassMetadata|null $parent - * @param bool $rootEntityFound - * @param array $nonSuperclassParents classnames all parent classes that are not marked as mapped superclasses + * @param bool $rootEntityFound + * @param array $nonSuperclassParents All parent class names + * that are not marked as mapped superclasses. + * * @return void */ abstract protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonSuperclassParents); @@ -333,15 +351,13 @@ protected function loadMetadata($name) * Creates a new ClassMetadata instance for the given class name. * * @param string $className + * * @return ClassMetadata */ abstract protected function newClassMetadataInstance($className); /** - * Check if this class is mapped by this Object Manager + ClassMetadata configuration - * - * @param $class - * @return bool + * {@inheritDoc} */ public function isTransient($class) { @@ -359,9 +375,11 @@ public function isTransient($class) } /** - * Set reflectionService. + * Sets the reflectionService. * * @param ReflectionService $reflectionService + * + * @return void */ public function setReflectionService(ReflectionService $reflectionService) { @@ -369,7 +387,7 @@ public function setReflectionService(ReflectionService $reflectionService) } /** - * Get the reflection service associated with this metadata factory. + * Gets the reflection service associated with this metadata factory. * * @return ReflectionService */ 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 4836bf8..b8445f1 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 @@ -22,20 +22,19 @@ /** * Contract for a Doctrine persistence layer ClassMetadata class to implement. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.1 - * @author Benjamin Eberlei - * @author Jonathan Wage + * @link www.doctrine-project.org + * @since 2.1 + * @author Benjamin Eberlei + * @author Jonathan Wage */ interface ClassMetadata { /** - * Get fully-qualified class name of this persistent class. + * Gets the fully-qualified class name of this persistent class. * * @return string */ - function getName(); + public function getName(); /** * Gets the mapped identifier field name. @@ -44,54 +43,59 @@ function getName(); * * @return array */ - function getIdentifier(); + public function getIdentifier(); /** * Gets the ReflectionClass instance for this mapped class. * * @return \ReflectionClass */ - function getReflectionClass(); + public function getReflectionClass(); /** * Checks if the given field name is a mapped identifier for this class. * * @param string $fieldName + * * @return boolean */ - function isIdentifier($fieldName); + public function isIdentifier($fieldName); /** * Checks if the given field is a mapped property for this class. * * @param string $fieldName + * * @return boolean */ - function hasField($fieldName); + public function hasField($fieldName); /** * Checks if the given field is a mapped association for this class. * * @param string $fieldName + * * @return boolean */ - function hasAssociation($fieldName); + public function hasAssociation($fieldName); /** * Checks if the given field is a mapped single valued association for this class. * * @param string $fieldName + * * @return boolean */ - function isSingleValuedAssociation($fieldName); + public function isSingleValuedAssociation($fieldName); /** * Checks if the given field is a mapped collection valued association for this class. * * @param string $fieldName + * * @return boolean */ - function isCollectionValuedAssociation($fieldName); + public function isCollectionValuedAssociation($fieldName); /** * A numerically indexed list of field names of this persistent class. @@ -100,23 +104,23 @@ function isCollectionValuedAssociation($fieldName); * * @return array */ - function getFieldNames(); + public function getFieldNames(); /** * Returns an array of identifier field names numerically indexed. * * @return array */ - function getIdentifierFieldNames(); + public function getIdentifierFieldNames(); /** - * A numerically indexed list of association names of this persistent class. + * Returns a numerically indexed list of association names of this persistent class. * * This array includes identifier associations if present on this class. * * @return array */ - function getAssociationNames(); + public function getAssociationNames(); /** * Returns a type name of this field. @@ -125,41 +129,46 @@ function getAssociationNames(); * integer, string, boolean, float/double, datetime. * * @param string $fieldName + * * @return string */ - function getTypeOfField($fieldName); + public function getTypeOfField($fieldName); /** * Returns the target class name of the given association. * * @param string $assocName + * * @return string */ - function getAssociationTargetClass($assocName); + public function getAssociationTargetClass($assocName); /** - * Checks if the association is the inverse side of a bidirectional association + * Checks if the association is the inverse side of a bidirectional association. * * @param string $assocName + * * @return boolean */ - function isAssociationInverseSide($assocName); + public function isAssociationInverseSide($assocName); /** - * Returns the target field of the owning side of the association + * Returns the target field of the owning side of the association. * * @param string $assocName + * * @return string */ - function getAssociationMappedByTargetField($assocName); + public function getAssociationMappedByTargetField($assocName); /** - * Return the identifier of this object as an array with field name as key. + * Returns the identifier of this object as an array with field name as key. * * Has to return an empty array if no identifier isset. * * @param object $object + * * @return array */ - function getIdentifierValues($object); + public function getIdentifierValues($object); } 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 3fa39bc..3d82881 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 @@ -22,11 +22,10 @@ /** * Contract for a Doctrine persistence layer ClassMetadata class to implement. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.1 - * @author Benjamin Eberlei - * @author Jonathan Wage + * @link www.doctrine-project.org + * @since 2.1 + * @author Benjamin Eberlei + * @author Jonathan Wage */ interface ClassMetadataFactory { @@ -36,39 +35,42 @@ * * @return array The ClassMetadata instances of all mapped classes. */ - function getAllMetadata(); + public function getAllMetadata(); /** * Gets the class metadata descriptor for a class. * * @param string $className The name of the class. + * * @return ClassMetadata */ - function getMetadataFor($className); + public function getMetadataFor($className); /** * Checks whether the factory has the metadata for a class loaded already. * * @param string $className + * * @return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise. */ - function hasMetadataFor($className); + public function hasMetadataFor($className); /** * Sets the metadata descriptor for a specific class. * * @param string $className + * * @param ClassMetadata $class */ - function setMetadataFor($className, $class); + public function setMetadataFor($className, $class); /** - * Whether the class with the specified name should have its metadata loaded. - * This is only the case if it is either mapped directly or as a - * MappedSuperclass. + * Returns whether the class with the specified name should have its metadata loaded. + * This is only the case if it is either mapped directly or as a MappedSuperclass. * * @param string $className + * * @return boolean */ - function isTransient($className); + public function isTransient($className); } 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 1131add..1737243 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 @@ -19,15 +19,14 @@ namespace Doctrine\Common\Persistence\Mapping\Driver; -use Doctrine\Common\Cache\ArrayCache, - Doctrine\Common\Annotations\AnnotationReader, - Doctrine\Common\Annotations\AnnotationRegistry, - Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\Common\Annotations\AnnotationReader; +use Doctrine\Common\Annotations\AnnotationRegistry; +use Doctrine\Common\Persistence\Mapping\MappingException; /** * The AnnotationDriver reads the mapping metadata from docblock annotations. * - * @since 2.2 + * @since 2.2 * @author Benjamin Eberlei * @author Guilherme Blanco * @author Jonathan H. Wage @@ -57,14 +56,14 @@ protected $fileExtension = '.php'; /** - * Cache for AnnotationDriver#getAllClassNames() + * Cache for AnnotationDriver#getAllClassNames(). * - * @var array + * @var array|null */ protected $classNames; /** - * Name of the entity annotations as keys + * Name of the entity annotations as keys. * * @var array */ @@ -74,8 +73,8 @@ * Initializes a new AnnotationDriver that uses the given AnnotationReader for reading * docblock annotations. * - * @param AnnotationReader $reader The AnnotationReader to use, duck-typed. - * @param string|array $paths One or multiple paths where mapping classes can be found. + * @param AnnotationReader $reader The AnnotationReader to use, duck-typed. + * @param string|array|null $paths One or multiple paths where mapping classes can be found. */ public function __construct($reader, $paths = null) { @@ -86,9 +85,11 @@ public function __construct($reader, $paths = null) } /** - * Append lookup paths to metadata driver. + * Appends lookup paths to metadata driver. * * @param array $paths + * + * @return void */ public function addPaths(array $paths) { @@ -96,7 +97,7 @@ public function addPaths(array $paths) } /** - * Retrieve the defined metadata lookup paths. + * Retrieves the defined metadata lookup paths. * * @return array */ @@ -106,7 +107,7 @@ public function getPaths() } /** - * Retrieve the current annotation reader + * Retrieves the current annotation reader. * * @return AnnotationReader */ @@ -116,7 +117,7 @@ public function getReader() } /** - * Get the file extension used to look for mapping files under + * Gets the file extension used to look for mapping files under. * * @return string */ @@ -126,9 +127,10 @@ public function getFileExtension() } /** - * Set the file extension used to look for mapping files under + * Sets the file extension used to look for mapping files under. + * + * @param string $fileExtension The file extension to set. * - * @param string $fileExtension The file extension to set * @return void */ public function setFileExtension($fileExtension) @@ -137,13 +139,14 @@ public function setFileExtension($fileExtension) } /** - * Whether the class with the specified name is transient. Only non-transient + * Returns whether the class with the specified name is transient. Only non-transient * classes, that is entities and mapped superclasses, should have their metadata loaded. * * A class is non-transient if it is annotated with an annotation * from the {@see AnnotationDriver::entityAnnotationClasses}. * * @param string $className + * * @return boolean */ public function isTransient($className) @@ -184,7 +187,7 @@ public function getAllClassNames() new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY ), - '/^.+' . str_replace('.', '\.', $this->fileExtension) . '$/i', + '/^.+' . preg_quote($this->fileExtension) . '$/i', \RecursiveRegexIterator::GET_MATCH ); 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 0d61174..6a9e276 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 @@ -15,16 +15,16 @@ * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * . -*/ + */ namespace Doctrine\Common\Persistence\Mapping\Driver; use Doctrine\Common\Persistence\Mapping\MappingException; /** - * Locate the file that contains the metadata information for a given class name. + * Locates 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 @@ -42,7 +42,7 @@ class DefaultFileLocator implements FileLocator /** * The file extension of mapping documents. * - * @var string + * @var string|null */ protected $fileExtension; @@ -50,8 +50,8 @@ class DefaultFileLocator implements FileLocator * Initializes a new FileDriver that looks in the given path(s) for mapping * 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 + * @param string|array $paths One or multiple paths where mapping documents can be found. + * @param string|null $fileExtension The file extension of mapping documents. */ public function __construct($paths, $fileExtension = null) { @@ -60,9 +60,11 @@ public function __construct($paths, $fileExtension = null) } /** - * Append lookup paths to metadata driver. + * Appends lookup paths to metadata driver. * * @param array $paths + * + * @return void */ public function addPaths(array $paths) { @@ -70,7 +72,7 @@ public function addPaths(array $paths) } /** - * Retrieve the defined metadata lookup paths. + * Retrieves the defined metadata lookup paths. * * @return array */ @@ -80,9 +82,9 @@ public function getPaths() } /** - * Get the file extension used to look for mapping files under + * Gets the file extension used to look for mapping files under. * - * @return string + * @return string|null */ public function getFileExtension() { @@ -90,9 +92,10 @@ public function getFileExtension() } /** - * Set the file extension used to look for mapping files under + * Sets the file extension used to look for mapping files under. + * + * @param string|null $fileExtension The file extension to set. * - * @param string $fileExtension The file extension to set * @return void */ public function setFileExtension($fileExtension) @@ -109,7 +112,7 @@ public function findMappingFile($className) // Check whether file exists foreach ($this->paths as $path) { - if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) { + if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return $path . DIRECTORY_SEPARATOR . $fileName; } } @@ -160,7 +163,7 @@ public function fileExists($className) // Check whether file exists foreach ((array) $this->paths as $path) { - if (file_exists($path . DIRECTORY_SEPARATOR . $fileName)) { + if (is_file($path . DIRECTORY_SEPARATOR . $fileName)) { return true; } } 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 b0a7685..ccc64fa 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 @@ -29,13 +29,12 @@ * file per class and the file names of the mapping files must correspond to the full * class name, including namespace, with the namespace delimiters '\', replaced by dots '.'. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.com - * @since 2.2 - * @author Benjamin Eberlei - * @author Guilherme Blanco - * @author Jonathan H. Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.2 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan H. Wage + * @author Roman Borschel */ abstract class FileDriver implements MappingDriver { @@ -45,12 +44,12 @@ protected $locator; /** - * @var array + * @var array|null */ protected $classCache; /** - * @var string + * @var string|null */ protected $globalBasename; @@ -58,8 +57,9 @@ * 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 $locator A FileLocator or one/multiple paths where mapping documents can be found. - * @param string $fileExtension + * @param string|array|FileLocator $locator A FileLocator or one/multiple paths + * where mapping documents can be found. + * @param string|null $fileExtension */ public function __construct($locator, $fileExtension = null) { @@ -71,9 +71,11 @@ public function __construct($locator, $fileExtension = null) } /** - * Set global basename + * Sets the global basename. * * @param string $file + * + * @return void */ public function setGlobalBasename($file) { @@ -81,9 +83,9 @@ public function setGlobalBasename($file) } /** - * Retrieve global basename + * Retrieves the global basename. * - * @return string + * @return string|null */ public function getGlobalBasename() { @@ -91,13 +93,14 @@ public function getGlobalBasename() } /** - * 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 + * Gets 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. * * @param string $className * + * @return array The element of schema meta data. + * * @throws MappingException - * @return array The element of schema meta data */ public function getElement($className) { @@ -118,12 +121,7 @@ public function getElement($className) } /** - * Whether the class with the specified name should have its metadata loaded. - * This is only the case if it is either mapped as an Entity or a - * MappedSuperclass. - * - * @param string $className - * @return boolean + * {@inheritDoc} */ public function isTransient($className) { @@ -139,9 +137,7 @@ public function isTransient($className) } /** - * Gets the names of all mapped classes known to this driver. - * - * @return array The names of all mapped classes known to this driver. + * {@inheritDoc} */ public function getAllClassNames() { @@ -161,12 +157,13 @@ public function getAllClassNames() * from class/entity names to their corresponding file driver elements. * * @param string $file The mapping file to load. + * * @return array */ abstract protected function loadMappingFile($file); /** - * Initialize the class cache from all the global files. + * Initializes the class cache from all the global files. * * Using this feature adds a substantial performance hit to file drivers as * more metadata has to be loaded into memory than might actually be @@ -193,7 +190,7 @@ protected function initialize() } /** - * Retrieve the locator used to discover mapping files by className + * Retrieves the locator used to discover mapping files by className. * * @return FileLocator */ @@ -203,7 +200,7 @@ public function getLocator() } /** - * Set the locator used to discover mapping files by className + * Sets the locator used to discover mapping files by className. * * @param FileLocator $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 ec2b606..f622856 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 @@ -15,12 +15,12 @@ * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * . -*/ + */ namespace Doctrine\Common\Persistence\Mapping\Driver; /** - * Locate the file that contains the metadata information for a given class name. + * Locates the file that contains the metadata information for a given class name. * * This behavior is independent of the actual content of the file. It just detects * the file which is responsible for the given class name. @@ -31,41 +31,43 @@ interface FileLocator { /** - * Locate mapping file for the given class name. + * Locates mapping file for the given class name. * * @param string $className + * * @return string */ - function findMappingFile($className); + public function findMappingFile($className); /** - * Get all class names that are found with this file locator. + * Gets all class names that are found with this file locator. + * + * @param string $globalBasename Passed to allow excluding the basename. * - * @param string $globalBasename Passed to allow excluding the basename * @return array */ - function getAllClassNames($globalBasename); + public function getAllClassNames($globalBasename); /** - * Check if a file can be found for this class name. + * Checks if a file can be found for this class name. * * @param string $className * * @return bool */ - function fileExists($className); + public function fileExists($className); /** - * Get all the paths that this file locator looks for mapping files. + * Gets all the paths that this file locator looks for mapping files. * * @return array */ - function getPaths(); + public function getPaths(); /** - * Get the file extension that mapping files are suffixed with. + * Gets the file extension that mapping files are suffixed with. * * @return string */ - function getFileExtension(); + public function getFileExtension(); } 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 955d831..b5d7ec0 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 @@ -24,7 +24,7 @@ /** * Contract for metadata drivers. * - * @since 2.2 + * @since 2.2 * @author Jonathan H. Wage */ interface MappingDriver @@ -32,25 +32,27 @@ /** * Loads the metadata for the specified class into the provided container. * - * @param string $className + * @param string $className * @param ClassMetadata $metadata + * + * @return void */ - function loadMetadataForClass($className, ClassMetadata $metadata); + public function loadMetadataForClass($className, ClassMetadata $metadata); /** * Gets the names of all mapped classes known to this driver. * * @return array The names of all mapped classes known to this driver. */ - function getAllClassNames(); + public function getAllClassNames(); /** - * Whether the class with the specified name should have its metadata loaded. - * This is only the case if it is either mapped as an Entity or a - * MappedSuperclass. + * Returns whether the class with the specified name should have its metadata loaded. + * This is only the case if it is either mapped as an Entity or a MappedSuperclass. * * @param string $className + * * @return boolean */ - function isTransient($className); + public function isTransient($className); } 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 3b1049d..5fa9a7a 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 @@ -19,13 +19,13 @@ namespace Doctrine\Common\Persistence\Mapping\Driver; -use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver, - Doctrine\Common\Persistence\Mapping\ClassMetadata, - Doctrine\Common\Persistence\Mapping\MappingException; +use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; +use Doctrine\Common\Persistence\Mapping\MappingException; /** * The DriverChain allows you to add multiple other mapping drivers for - * certain namespaces + * certain namespaces. * * @since 2.2 * @author Benjamin Eberlei @@ -36,11 +36,11 @@ class MappingDriverChain implements MappingDriver { /** - * The default driver + * The default driver. * - * @var MappingDriver + * @var MappingDriver|null */ - private $defaultDriver; + private $defaultDriver = null; /** * @var array @@ -48,7 +48,7 @@ class MappingDriverChain implements MappingDriver private $drivers = array(); /** - * Get the default driver. + * Gets the default driver. * * @return MappingDriver|null */ @@ -61,6 +61,8 @@ public function getDefaultDriver() * Set the default driver. * * @param MappingDriver $driver + * + * @return void */ public function setDefaultDriver(MappingDriver $driver) { @@ -68,10 +70,12 @@ public function setDefaultDriver(MappingDriver $driver) } /** - * Add a nested driver. + * Adds a nested driver. * * @param MappingDriver $nestedDriver - * @param string $namespace + * @param string $namespace + * + * @return void */ public function addDriver(MappingDriver $nestedDriver, $namespace) { @@ -79,7 +83,7 @@ public function addDriver(MappingDriver $nestedDriver, $namespace) } /** - * Get the array of nested drivers. + * Gets the array of nested drivers. * * @return array $drivers */ @@ -89,12 +93,7 @@ public function getDrivers() } /** - * Loads the metadata for the specified class into the provided container. - * - * @param string $className - * @param ClassMetadata $metadata - * - * @throws MappingException + * {@inheritDoc} */ public function loadMetadataForClass($className, ClassMetadata $metadata) { @@ -115,9 +114,7 @@ public function loadMetadataForClass($className, ClassMetadata $metadata) } /** - * Gets the names of all mapped classes known to this driver. - * - * @return array The names of all mapped classes known to this driver. + * {@inheritDoc} */ public function getAllClassNames() { @@ -139,16 +136,17 @@ public function getAllClassNames() } } + if (null !== $this->defaultDriver) { + foreach ($this->defaultDriver->getAllClassNames() as $className) { + $classNames[$className] = true; + } + } + return array_keys($classNames); } /** - * Whether the class with the specified name should have its metadata loaded. - * - * This is only the case for non-transient classes either mapped as an Entity or MappedSuperclass. - * - * @param string $className - * @return boolean + * {@inheritDoc} */ public function isTransient($className) { 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 e0c8611..31651f3 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 @@ -23,21 +23,19 @@ /** * The PHPDriver includes php files which just populate ClassMetadataInfo - * instances with plain php code + * instances with plain PHP code. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.0 - * @version $Revision$ - * @author Benjamin Eberlei - * @author Guilherme Blanco - * @author Jonathan H. Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan H. Wage + * @author Roman Borschel */ class PHPDriver extends FileDriver { /** - * {@inheritdoc} + * {@inheritDoc} */ protected $metadata; @@ -51,7 +49,7 @@ public function __construct($locator, $fileExtension = null) } /** - * {@inheritdoc} + * {@inheritDoc} */ public function loadMetadataForClass($className, ClassMetadata $metadata) { @@ -60,7 +58,7 @@ public function loadMetadataForClass($className, ClassMetadata $metadata) } /** - * {@inheritdoc} + * {@inheritDoc} */ protected function loadMappingFile($file) { 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 e3cea73..df8f477 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 @@ -26,13 +26,12 @@ * The StaticPHPDriver calls a static loadMetadata() method on your entity * classes where you can manually populate the ClassMetadata instance. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.2 - * @author Benjamin Eberlei - * @author Guilherme Blanco - * @author Jonathan H. Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.2 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan H. Wage + * @author Roman Borschel */ class StaticPHPDriver implements MappingDriver { @@ -51,7 +50,7 @@ class StaticPHPDriver implements MappingDriver private $classNames; /** - * Constructor + * Constructor. * * @param array|string $paths */ @@ -61,9 +60,11 @@ public function __construct($paths) } /** - * Add paths + * Adds paths. * * @param array $paths + * + * @return void */ public function addPaths(array $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 9095187..dd4d741 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 @@ -15,7 +15,7 @@ * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see * . -*/ + */ namespace Doctrine\Common\Persistence\Mapping\Driver; @@ -26,8 +26,8 @@ * to the DefaultFileLocator. By assuming paths only contain entities of a certain * namespace the mapping files consists of the short classname only. * - * @author Fabien Potencier - * @author Benjamin Eberlei + * @author Fabien Potencier + * @author Benjamin Eberlei * @license MIT */ class SymfonyFileLocator implements FileLocator @@ -49,14 +49,14 @@ class SymfonyFileLocator implements FileLocator /** * File extension that is searched for. * - * @var string + * @var string|null */ protected $fileExtension; /** - * Constructor + * Constructor. * - * @param array $prefixes + * @param array $prefixes * @param string|null $fileExtension */ public function __construct(array $prefixes, $fileExtension = null) @@ -66,9 +66,11 @@ public function __construct(array $prefixes, $fileExtension = null) } /** - * Add Namespace Prefixes + * Adds Namespace Prefixes. * * @param array $prefixes + * + * @return void */ public function addNamespacePrefixes(array $prefixes) { @@ -77,7 +79,7 @@ public function addNamespacePrefixes(array $prefixes) } /** - * Get Namespace Prefixes + * Gets Namespace Prefixes. * * @return array */ @@ -103,9 +105,10 @@ public function getFileExtension() } /** - * Set the file extension used to look for mapping files under + * Sets the file extension used to look for mapping files under. + * + * @param string $fileExtension The file extension to set. * - * @param string $fileExtension The file extension to set * @return void */ public function setFileExtension($fileExtension) 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 c1e7ad5..c8c32b2 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 @@ -14,7 +14,7 @@ * * This software consists of voluntary contributions made by many individuals * and is licensed under the MIT license. For more information, see - * . + * . */ namespace Doctrine\Common\Persistence\Mapping; @@ -27,9 +27,8 @@ class MappingException extends \Exception { /** - * * @param string $className - * @param array $namespaces + * @param array $namespaces * * @return MappingException */ @@ -50,6 +49,7 @@ public static function pathRequired() /** * @param string|null $path + * * @return MappingException */ public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null) @@ -67,6 +67,7 @@ public static function fileMappingDriversRequireConfiguredDirectoryPath($path = /** * @param string $entityName * @param string $fileName + * * @return MappingException */ public static function mappingFileNotFound($entityName, $fileName) @@ -77,10 +78,21 @@ public static function mappingFileNotFound($entityName, $fileName) /** * @param string $entityName * @param string $fileName + * * @return MappingException */ public static function invalidMappingFile($entityName, $fileName) { return new self("Invalid mapping file '$fileName' for class '$entityName'."); } + + /** + * @param string $className + * + * @return \Doctrine\Common\Persistence\Mapping\MappingException + */ + public static function nonExistingClass($className) + { + return new self("Class '$className' does not exist"); + } } 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 3db85d9..0088ed5 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 @@ -30,51 +30,58 @@ interface ReflectionService { /** - * Return an array of the parent classes (not interfaces) for the given class. + * Returns an array of the parent classes (not interfaces) for the given class. * * @param string $class + * + * @throws \Doctrine\Common\Persistence\Mapping\MappingException + * * @return array */ - function getParentClasses($class); + public function getParentClasses($class); /** - * Return the shortname of a class. + * Returns the shortname of a class. * * @param string $class + * * @return string */ - function getClassShortName($class); + public function getClassShortName($class); /** * @param string $class + * * @return string */ - function getClassNamespace($class); + public function getClassNamespace($class); /** - * Return a reflection class instance or null + * Returns a reflection class instance or null. * * @param string $class + * * @return \ReflectionClass|null */ - function getClass($class); + public function getClass($class); /** - * Return an accessible property (setAccessible(true)) or null. + * Returns an accessible property (setAccessible(true)) or null. * * @param string $class * @param string $property + * * @return \ReflectionProperty|null */ - function getAccessibleProperty($class, $property); + public function getAccessibleProperty($class, $property); /** - * Check if the class have a public method with the given name. + * Checks if the class have a public method with the given name. * * @param mixed $class * @param mixed $method + * * @return bool */ - function hasPublicMethod($class, $method); + public function hasPublicMethod($class, $method); } - 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 77b9e76..c5a37a8 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 @@ -21,52 +21,50 @@ use ReflectionClass; use ReflectionProperty; +use Doctrine\Common\Reflection\RuntimePublicReflectionProperty; +use Doctrine\Common\Persistence\Mapping\MappingException; /** - * PHP Runtime Reflection Service + * PHP Runtime Reflection Service. * * @author Benjamin Eberlei */ class RuntimeReflectionService implements ReflectionService { /** - * Return an array of the parent classes (not interfaces) for the given class. - * - * @param string $class - * @return array + * {@inheritDoc} */ public function getParentClasses($class) { + if ( ! class_exists($class)) { + throw MappingException::nonExistingClass($class); + } + return class_parents($class); } /** - * Return the shortname of a class. - * - * @param string $class - * @return string + * {@inheritDoc} */ public function getClassShortName($class) { - $r = new ReflectionClass($class); - return $r->getShortName(); + $reflectionClass = new ReflectionClass($class); + + return $reflectionClass->getShortName(); } /** - * @param string $class - * @return string + * {@inheritDoc} */ public function getClassNamespace($class) { - $r = new ReflectionClass($class); - return $r->getNamespaceName(); + $reflectionClass = new ReflectionClass($class); + + return $reflectionClass->getNamespaceName(); } /** - * Return a reflection class instance or null - * - * @param string $class - * @return ReflectionClass|null + * {@inheritDoc} */ public function getClass($class) { @@ -74,29 +72,26 @@ public function getClass($class) } /** - * Return an accessible property (setAccessible(true)) or null. - * - * @param string $class - * @param string $property - * @return ReflectionProperty|null + * {@inheritDoc} */ public function getAccessibleProperty($class, $property) { - $property = new ReflectionProperty($class, $property); - $property->setAccessible(true); - return $property; + $reflectionProperty = new ReflectionProperty($class, $property); + + if ($reflectionProperty->isPublic()) { + $reflectionProperty = new RuntimePublicReflectionProperty($class, $property); + } + + $reflectionProperty->setAccessible(true); + + return $reflectionProperty; } /** - * Check if the class have a public method with the given name. - * - * @param mixed $class - * @param mixed $method - * @return bool + * {@inheritDoc} */ public function hasPublicMethod($class, $method) { return method_exists($class, $method) && is_callable(array($class, $method)); } } - 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 4f6d1cf..f903097 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 @@ -19,21 +19,15 @@ namespace Doctrine\Common\Persistence\Mapping; -use ReflectionClass; -use ReflectionProperty; - /** - * PHP Runtime Reflection Service + * PHP Runtime Reflection Service. * * @author Benjamin Eberlei */ class StaticReflectionService implements ReflectionService { /** - * Return an array of the parent classes (not interfaces) for the given class. - * - * @param string $class - * @return array + * {@inheritDoc} */ public function getParentClasses($class) { @@ -41,10 +35,7 @@ public function getParentClasses($class) } /** - * Return the shortname of a class. - * - * @param string $className - * @return string + * {@inheritDoc} */ public function getClassShortName($className) { @@ -55,10 +46,7 @@ public function getClassShortName($className) } /** - * Return the namespace of a class. - * - * @param string $className - * @return string + * {@inheritDoc} */ public function getClassNamespace($className) { @@ -70,10 +58,7 @@ public function getClassNamespace($className) } /** - * Return a reflection class instance or null - * - * @param string $class - * @return ReflectionClass|null + * {@inheritDoc} */ public function getClass($class) { @@ -81,11 +66,7 @@ public function getClass($class) } /** - * Return an accessible property (setAccessible(true)) or null. - * - * @param string $class - * @param string $property - * @return ReflectionProperty|null + * {@inheritDoc} */ public function getAccessibleProperty($class, $property) { @@ -93,15 +74,10 @@ public function getAccessibleProperty($class, $property) } /** - * Check if the class have a public method with the given name. - * - * @param mixed $class - * @param mixed $method - * @return bool + * {@inheritDoc} */ public function hasPublicMethod($class, $method) { return method_exists($class, $method) && is_callable(array($class, $method)); } } - 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 2bb8722..bb29e43 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManager.php @@ -22,11 +22,10 @@ /** * Contract for a Doctrine persistence layer ObjectManager class to implement. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.1 - * @author Benjamin Eberlei - * @author Jonathan Wage + * @link www.doctrine-project.org + * @since 2.1 + * @author Benjamin Eberlei + * @author Jonathan Wage */ interface ObjectManager { @@ -35,11 +34,12 @@ * * This is just a convenient shortcut for getRepository($className)->find($id). * - * @param string - * @param mixed - * @return object + * @param string $className The class name of the object to find. + * @param mixed $id The identity of the object to find. + * + * @return object The found object. */ - function find($className, $id); + public function find($className, $id); /** * Tells the ObjectManager to make an instance managed and persistent. @@ -50,8 +50,10 @@ function find($className, $id); * this ObjectManager as NEW. Do not pass detached objects to the persist operation. * * @param object $object The instance to make managed and persistent. + * + * @return void */ - function persist($object); + public function persist($object); /** * Removes an object instance. @@ -59,8 +61,10 @@ function persist($object); * A removed object will be removed from the database as a result of the flush operation. * * @param object $object The object instance to remove. + * + * @return void */ - function remove($object); + public function remove($object); /** * Merges the state of a detached object into the persistence context @@ -68,17 +72,20 @@ function remove($object); * The object passed to merge will not become associated/managed with this ObjectManager. * * @param object $object + * * @return object */ - function merge($object); + public 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 + * @param string|null $objectName if given, only objects of this type will get detached. + * + * @return void */ - function clear($objectName = null); + public function clear($objectName = null); /** * Detaches an object from the ObjectManager, causing a managed object to @@ -88,31 +95,38 @@ function clear($objectName = null); * reference it. * * @param object $object The object to detach. + * + * @return void */ - function detach($object); + public function detach($object); /** * Refreshes the persistent state of an object from the database, * overriding any local changes that have not yet been persisted. * * @param object $object The object to refresh. + * + * @return void */ - function refresh($object); + public function refresh($object); /** * Flushes all changes to objects that have been queued up to now to the database. * This effectively synchronizes the in-memory state of managed objects with the * database. + * + * @return void */ - function flush(); + public function flush(); /** * Gets the repository for a class. * * @param string $className + * * @return \Doctrine\Common\Persistence\ObjectRepository */ - function getRepository($className); + public function getRepository($className); /** * Returns the ClassMetadata descriptor for a class. @@ -121,16 +135,17 @@ function getRepository($className); * (as it is returned by get_class($obj)). * * @param string $className + * * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata */ - function getClassMetadata($className); + public function getClassMetadata($className); /** * Gets the metadata factory used to gather the metadata of classes. * * @return \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory */ - function getMetadataFactory(); + public function getMetadataFactory(); /** * Helper method to initialize a lazy loading proxy or persistent collection. @@ -138,15 +153,17 @@ function getMetadataFactory(); * This method is a no-op for other objects. * * @param object $obj + * + * @return void */ - function initializeObject($obj); + public function initializeObject($obj); /** - * Check if the object is part of the current UnitOfWork and therefore - * managed. + * Checks if the object is part of the current UnitOfWork and therefore managed. * * @param object $object + * * @return bool */ - function contains($object); + public function contains($object); } 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 69fba78..9bc248a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerAware.php @@ -26,7 +26,7 @@ * * Using this interface the managing object manager and class metadata instances * are injected into the persistent object after construction. This allows - * you to implement ActiveRecord functionality on top of the persistance-ignorance + * you to implement ActiveRecord functionality on top of the persistence-ignorance * that Doctrine propagates. * * Word of Warning: This is a very powerful hook to change how you can work with your domain models. @@ -44,6 +44,8 @@ * * @param ObjectManager $objectManager * @param ClassMetadata $classMetadata + * + * @return void */ public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata); } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerDecorator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerDecorator.php new file mode 100644 index 0000000..8946475 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectManagerDecorator.php @@ -0,0 +1,140 @@ +. + */ + +namespace Doctrine\Common\Persistence; + +/** + * Base class to simplify ObjectManager decorators + * + * @license http://opensource.org/licenses/MIT MIT + * @link www.doctrine-project.org + * @since 2.4 + * @author Lars Strojny + */ +abstract class ObjectManagerDecorator implements ObjectManager +{ + /** + * @var ObjectManager + */ + protected $wrapped; + + /** + * {@inheritdoc} + */ + public function find($className, $id) + { + return $this->wrapped->find($className, $id); + } + + /** + * {@inheritdoc} + */ + public function persist($object) + { + return $this->wrapped->persist($object); + } + + /** + * {@inheritdoc} + */ + public function remove($object) + { + return $this->wrapped->remove($object); + } + + /** + * {@inheritdoc} + */ + public function merge($object) + { + return $this->wrapped->merge($object); + } + + /** + * {@inheritdoc} + */ + public function clear($objectName = null) + { + return $this->wrapped->clear($objectName); + } + + /** + * {@inheritdoc} + */ + public function detach($object) + { + return $this->wrapped->detach($object); + } + + /** + * {@inheritdoc} + */ + public function refresh($object) + { + return $this->wrapped->refresh($object); + } + + /** + * {@inheritdoc} + */ + public function flush() + { + return $this->wrapped->flush(); + } + + /** + * {@inheritdoc} + */ + public function getRepository($className) + { + return $this->wrapped->getRepository($className); + } + + /** + * {@inheritdoc} + */ + public function getClassMetadata($className) + { + return $this->wrapped->getClassMetadata($className); + } + + /** + * {@inheritdoc} + */ + public function getMetadataFactory() + { + return $this->wrapped->getMetadataFactory(); + } + + /** + * {@inheritdoc} + */ + public function initializeObject($obj) + { + return $this->wrapped->initializeObject($obj); + } + + /** + * {@inheritdoc} + */ + public function contains($object) + { + return $this->wrapped->contains($object); + } +} 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 9a3e5b6..f607219 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/ObjectRepository.php @@ -22,28 +22,28 @@ /** * Contract for a Doctrine persistence layer ObjectRepository class to implement. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.1 - * @author Benjamin Eberlei - * @author Jonathan Wage + * @link www.doctrine-project.org + * @since 2.1 + * @author Benjamin Eberlei + * @author Jonathan Wage */ interface ObjectRepository { /** * Finds an object by its primary key / identifier. * - * @param int $id The identifier. + * @param mixed $id The identifier. + * * @return object The object. */ - function find($id); + public function find($id); /** * Finds all objects in the repository. * - * @return mixed The objects. + * @return array The objects. */ - function findAll(); + public function findAll(); /** * Finds objects by a set of criteria. @@ -52,27 +52,30 @@ function findAll(); * an UnexpectedValueException if certain values of the sorting or limiting details are * not supported. * - * @throws \UnexpectedValueException - * @param array $criteria + * @param array $criteria * @param array|null $orderBy - * @param int|null $limit - * @param int|null $offset - * @return mixed The objects. + * @param int|null $limit + * @param int|null $offset + * + * @return array The objects. + * + * @throws \UnexpectedValueException */ - function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null); + public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null); /** * Finds a single object by a set of criteria. * - * @param array $criteria + * @param array $criteria The criteria. + * * @return object The object. */ - function findOneBy(array $criteria); + public function findOneBy(array $criteria); /** - * Returns the class name of the object managed by the repository + * Returns the class name of the object managed by the repository. * * @return string */ - function getClassName(); + public function getClassName(); } 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 9fcc4cb..08c6942 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/PersistentObject.php @@ -29,7 +29,6 @@ * * This class is a forward compatible implementation of the PersistentObject trait. * - * * Limitations: * * 1. All persistent objects have to be associated with a single ObjectManager, multiple @@ -38,7 +37,7 @@ * This is either done on `postLoad` of an object or by accessing the global object manager. * 3. There are no hooks for setters/getters. Just implement the method yourself instead of relying on __call(). * 4. Slower than handcoded implementations: An average of 7 method calls per access to a field and 11 for an association. - * 5. Only the inverse side associations get autoset on the owning side aswell. Setting objects on the owning side + * 5. Only the inverse side associations get autoset on the owning side as well. Setting objects on the owning side * will not set the inverse side associations. * * @example @@ -58,19 +57,21 @@ abstract class PersistentObject implements ObjectManagerAware { /** - * @var ObjectManager + * @var ObjectManager|null */ - private static $objectManager; + private static $objectManager = null; /** - * @var ClassMetadata + * @var ClassMetadata|null */ - private $cm; + private $cm = null; /** - * Set the object manager responsible for all persistent object base classes. + * Sets the object manager responsible for all persistent object base classes. * - * @param ObjectManager $objectManager + * @param ObjectManager|null $objectManager + * + * @return void */ static public function setObjectManager(ObjectManager $objectManager = null) { @@ -78,7 +79,7 @@ static public function setObjectManager(ObjectManager $objectManager = null) } /** - * @return ObjectManager + * @return ObjectManager|null */ static public function getObjectManager() { @@ -86,11 +87,13 @@ static public function getObjectManager() } /** - * Inject Doctrine Object Manager + * Injects the Doctrine Object Manager. * * @param ObjectManager $objectManager * @param ClassMetadata $classMetadata * + * @return void + * * @throws \RuntimeException */ public function injectObjectManager(ObjectManager $objectManager, ClassMetadata $classMetadata) @@ -107,11 +110,12 @@ public function injectObjectManager(ObjectManager $objectManager, ClassMetadata * Sets a persistent fields value. * * @param string $field - * @param array $args + * @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 + * + * @throws \BadMethodCallException When no persistent field exists by that name. + * @throws \InvalidArgumentException When the wrong target object type is passed to an association. */ private function set($field, $args) { @@ -132,13 +136,13 @@ private function set($field, $args) } /** - * Get persistent field value. - * + * Gets a persistent field value. * * @param string $field * - * @throws \BadMethodCallException - When no persistent field exists by that name. * @return mixed + * + * @throws \BadMethodCallException When no persistent field exists by that name. */ private function get($field) { @@ -152,15 +156,17 @@ private function get($field) } /** - * If this is an inverse side association complete the owning side. + * If this is an inverse side association, completes the owning side. * - * @param string $field + * @param string $field * @param ClassMetadata $targetClass - * @param object $targetObject + * @param object $targetObject + * + * @return void */ private function completeOwningSide($field, $targetClass, $targetObject) { - // add this object on the owning side aswell, for obvious infinite recursion + // add this object on the owning side as well, for obvious infinite recursion // reasons this is only done when called on the inverse side. if ($this->cm->isAssociationInverseSide($field)) { $mappedByField = $this->cm->getAssociationMappedByTargetField($field); @@ -172,10 +178,12 @@ private function completeOwningSide($field, $targetClass, $targetObject) } /** - * Add an object to a collection + * Adds an object to a collection. * * @param string $field - * @param array $args + * @param array $args + * + * @return void * * @throws \BadMethodCallException * @throws \InvalidArgumentException @@ -200,10 +208,11 @@ private function add($field, $args) } /** - * Initialize Doctrine Metadata for this class. + * Initializes Doctrine Metadata for this class. * - * @throws \RuntimeException * @return void + * + * @throws \RuntimeException */ private function initializeDoctrine() { @@ -219,13 +228,14 @@ private function initializeDoctrine() } /** - * Magic method that implements + * Magic methods. * * @param string $method - * @param array $args + * @param array $args * - * @throws \BadMethodCallException * @return mixed + * + * @throws \BadMethodCallException */ 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 e25598c..3369eb9 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Proxy.php @@ -1,5 +1,4 @@ - * @since 2.2 + * @since 2.2 */ interface Proxy { @@ -36,14 +35,14 @@ const MARKER = '__CG__'; /** - * Length of the proxy marker + * Length of the proxy marker. * - * @var int + * @var integer */ const MARKER_LENGTH = 6; /** - * Initialize this proxy if its not yet initialized. + * Initializes this proxy if its not yet initialized. * * Acts as a no-op if already initialized. * @@ -52,7 +51,7 @@ public function __load(); /** - * Is this proxy initialized or not. + * Returns whether this proxy is initialized or not. * * @return bool */ diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php b/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php index 1171874..1a59cd4 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/PropertyChangedListener.php @@ -1,7 +1,5 @@ NotifyPropertyChanged * implementor. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.0 - * @version $Revision: 3938 $ - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ interface PropertyChangedListener { /** * Notifies the listener of a property change. * - * @param object $sender The object on which the property changed. + * @param object $sender The object on which the property changed. * @param string $propertyName The name of the property that changed. - * @param mixed $oldValue The old value of the property that changed. - * @param mixed $newValue The new value of the property that changed. + * @param mixed $oldValue The old value of the property that changed. + * @param mixed $newValue The new value of the property that changed. + * + * @return void */ function propertyChanged($sender, $propertyName, $oldValue, $newValue); } - diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php new file mode 100644 index 0000000..b8ba677 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/AbstractProxyFactory.php @@ -0,0 +1,184 @@ +. + */ + +namespace Doctrine\Common\Proxy; + +use Doctrine\Common\Persistence\Mapping\ClassMetadataFactory; +use Doctrine\Common\Proxy\Exception\InvalidArgumentException; +use Doctrine\Common\Util\ClassUtils; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; + +/** + * Abstract factory for proxy objects. + * + * @author Benjamin Eberlei + */ +abstract class AbstractProxyFactory +{ + /** + * @var \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory + */ + private $metadataFactory; + + /** + * @var \Doctrine\Common\Proxy\ProxyGenerator the proxy generator responsible for creating the proxy classes/files. + */ + private $proxyGenerator; + + /** + * @var bool Whether to automatically (re)generate proxy classes. + */ + private $autoGenerate; + + /** + * @var \Doctrine\Common\Proxy\ProxyDefinition[] + */ + private $definitions = array(); + + /** + * @param \Doctrine\Common\Proxy\ProxyGenerator $proxyGenerator + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadataFactory $metadataFactory + * @param bool $autoGenerate + */ + public function __construct(ProxyGenerator $proxyGenerator, ClassMetadataFactory $metadataFactory, $autoGenerate) + { + $this->proxyGenerator = $proxyGenerator; + $this->metadataFactory = $metadataFactory; + $this->autoGenerate = $autoGenerate; + } + + /** + * Gets a reference proxy instance for the entity of the given type and identified by + * the given identifier. + * + * @param string $className + * @param array $identifier + * + * @return \Doctrine\Common\Proxy\Proxy + */ + public function getProxy($className, array $identifier) + { + $definition = isset($this->definitions[$className]) + ? $this->definitions[$className] + : $this->getProxyDefinition($className); + $fqcn = $definition->proxyClassName; + $proxy = new $fqcn($definition->initializer, $definition->cloner); + + foreach ($definition->identifierFields as $idField) { + $definition->reflectionFields[$idField]->setValue($proxy, $identifier[$idField]); + } + + return $proxy; + } + + /** + * Generates proxy classes for all given classes. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata[] $classes The classes (ClassMetadata instances) + * for which to generate proxies. + * @param string $proxyDir The target directory of the proxy classes. If not specified, the + * directory configured on the Configuration of the EntityManager used + * by this factory is used. + * @return int Number of generated proxies. + */ + public function generateProxyClasses(array $classes, $proxyDir = null) + { + $generated = 0; + + foreach ($classes as $class) { + if ($this->skipClass($class)) { + continue; + } + + $proxyFileName = $this->proxyGenerator->getProxyFileName($class->getName(), $proxyDir); + + $this->proxyGenerator->generateProxyClass($class, $proxyFileName); + + $generated += 1; + } + + return $generated; + } + + /** + * Reset initialization/cloning logic for an un-initialized proxy + * + * @param \Doctrine\Common\Proxy\Proxy $proxy + * + * @return \Doctrine\Common\Proxy\Proxy + * + * @throws \Doctrine\Common\Proxy\Exception\InvalidArgumentException + */ + public function resetUninitializedProxy(Proxy $proxy) + { + if ($proxy->__isInitialized()) { + throw InvalidArgumentException::unitializedProxyExpected($proxy); + } + + $className = ClassUtils::getClass($proxy); + $definition = isset($this->definitions[$className]) + ? $this->definitions[$className] + : $this->getProxyDefinition($className); + + $proxy->__setInitializer($definition->initializer); + $proxy->__setCloner($definition->cloner); + + return $proxy; + } + + /** + * Get a proxy definition for the given class name. + * + * @return ProxyDefinition + */ + private function getProxyDefinition($className) + { + $classMetadata = $this->metadataFactory->getMetadataFor($className); + $className = $classMetadata->getName(); // aliases and case sensitivity + + $this->definitions[$className] = $this->createProxyDefinition($className); + $proxyClassName = $this->definitions[$className]->proxyClassName; + + if ( ! class_exists($proxyClassName, false)) { + $fileName = $this->proxyGenerator->getProxyFileName($className); + + if ($this->autoGenerate) { + $this->proxyGenerator->generateProxyClass($classMetadata); + } + + require $fileName; + } + + return $this->definitions[$className]; + } + + /** + * Determine if this class should be skipped during proxy generation. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $metadata + * @return bool + */ + abstract protected function skipClass(ClassMetadata $metadata); + + /** + * @return ProxyDefinition + */ + abstract protected function createProxyDefinition($className); +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Autoloader.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Autoloader.php new file mode 100644 index 0000000..0aa930b --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Autoloader.php @@ -0,0 +1,92 @@ +. + */ + +namespace Doctrine\Common\Proxy; + +use Doctrine\Common\Proxy\Exception\InvalidArgumentException; + +/** + * Special Autoloader for Proxy classes, which are not PSR-0 compliant. + * + * @author Benjamin Eberlei + */ +class Autoloader +{ + /** + * Resolves proxy class name to a filename based on the following pattern. + * + * 1. Remove Proxy namespace from class name. + * 2. Remove namespace separators from remaining class name. + * 3. Return PHP filename from proxy-dir with the result from 2. + * + * @param string $proxyDir + * @param string $proxyNamespace + * @param string $className + * + * @return string + * + * @throws InvalidArgumentException + */ + public static function resolveFile($proxyDir, $proxyNamespace, $className) + { + if (0 !== strpos($className, $proxyNamespace)) { + throw InvalidArgumentException::notProxyClass($className, $proxyNamespace); + } + + $className = str_replace('\\', '', substr($className, strlen($proxyNamespace) + 1)); + + return $proxyDir . DIRECTORY_SEPARATOR . $className . '.php'; + } + + /** + * Registers and returns autoloader callback for the given proxy dir and namespace. + * + * @param string $proxyDir + * @param string $proxyNamespace + * @param callable|null $notFoundCallback Invoked when the proxy file is not found. + * + * @return \Closure + * + * @throws InvalidArgumentException + */ + public static function register($proxyDir, $proxyNamespace, $notFoundCallback = null) + { + $proxyNamespace = ltrim($proxyNamespace, '\\'); + + if ( ! (null === $notFoundCallback || is_callable($notFoundCallback))) { + throw InvalidArgumentException::invalidClassNotFoundCallback($notFoundCallback); + } + + $autoloader = function ($className) use ($proxyDir, $proxyNamespace, $notFoundCallback) { + if (0 === strpos($className, $proxyNamespace)) { + $file = Autoloader::resolveFile($proxyDir, $proxyNamespace, $className); + + if ($notFoundCallback && ! file_exists($file)) { + call_user_func($notFoundCallback, $proxyDir, $proxyNamespace, $className); + } + + require $file; + } + }; + + spl_autoload_register($autoloader); + + return $autoloader; + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php new file mode 100644 index 0000000..24a2194 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php @@ -0,0 +1,90 @@ +. + */ + +namespace Doctrine\Common\Proxy\Exception; + +use Doctrine\Common\Persistence\Proxy; +use InvalidArgumentException as BaseInvalidArgumentException; + +/** + * Proxy Invalid Argument Exception. + * + * @link www.doctrine-project.org + * @since 2.4 + * @author Marco Pivetta + */ +class InvalidArgumentException extends BaseInvalidArgumentException implements ProxyException +{ + /** + * @return self + */ + public static function proxyDirectoryRequired() + { + return new self('You must configure a proxy directory. See docs for details'); + } + + /** + * @param string $className + * @param string $proxyNamespace + * + * @return self + */ + public static function notProxyClass($className, $proxyNamespace) + { + return new self(sprintf('The class "%s" is not part of the proxy namespace "%s"', $className, $proxyNamespace)); + } + + /** + * @param string $name + * + * @return self + */ + public static function invalidPlaceholder($name) + { + return new self(sprintf('Provided placeholder for "%s" must be either a string or a valid callable', $name)); + } + + /** + * @return self + */ + public static function proxyNamespaceRequired() + { + return new self('You must configure a proxy namespace'); + } + + /** + * @return self + */ + public static function unitializedProxyExpected(Proxy $proxy) + { + return new self(sprintf('Provided proxy of type "%s" must not be initialized.', get_class($proxy))); + } + + /** + * @param mixed $callback + * + * @return self + */ + public static function invalidClassNotFoundCallback($callback) + { + $type = is_object($callback) ? get_class($callback) : gettype($callback); + + return new self(sprintf('Invalid \$notFoundCallback given: must be a callable, "%s" given', $type)); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/ProxyException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/ProxyException.php new file mode 100644 index 0000000..0d1ff14 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/ProxyException.php @@ -0,0 +1,31 @@ +. + */ + +namespace Doctrine\Common\Proxy\Exception; + +/** + * Base exception interface for proxy exceptions. + * + * @link www.doctrine-project.org + * @since 2.4 + * @author Marco Pivetta + */ +interface ProxyException +{ +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php new file mode 100644 index 0000000..73ec64d --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/UnexpectedValueException.php @@ -0,0 +1,62 @@ +. + */ + +namespace Doctrine\Common\Proxy\Exception; + +use UnexpectedValueException as BaseUnexpectedValueException; + +/** + * Proxy Unexpected Value Exception. + * + * @link www.doctrine-project.org + * @since 2.4 + * @author Marco Pivetta + */ +class UnexpectedValueException extends BaseUnexpectedValueException implements ProxyException +{ + /** + * @return self + */ + public static function proxyDirectoryNotWritable() + { + return new self('Your proxy directory must be writable'); + } + + /** + * @param string $className + * @param string $methodName + * @param string $parameterName + * @param \Exception $previous + * + * @return self + */ + public static function invalidParameterTypeHint($className, $methodName, $parameterName, \Exception $previous) + { + return new self( + sprintf( + 'The type hint of parameter "%s" in method "%s" in class "%s" is invalid.', + $parameterName, + $methodName, + $className + ), + 0, + $previous + ); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Proxy.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Proxy.php new file mode 100644 index 0000000..8368430 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Proxy.php @@ -0,0 +1,90 @@ +. + */ + +namespace Doctrine\Common\Proxy; + +use Doctrine\Common\Persistence\Proxy as BaseProxy; +use Closure; + +/** + * Interface for proxy classes. + * + * @author Roman Borschel + * @author Marco Pivetta + * @since 2.4 + */ +interface Proxy extends BaseProxy +{ + /** + * Marks the proxy as initialized or not. + * + * @param boolean $initialized + * + * @return void + */ + public function __setInitialized($initialized); + + /** + * Sets the initializer callback to be used when initializing the proxy. That + * initializer should accept 3 parameters: $proxy, $method and $params. Those + * are respectively the proxy object that is being initialized, the method name + * that triggered initialization and the parameters passed to that method. + * + * @param Closure|null $initializer + * + * @return void + */ + public function __setInitializer(Closure $initializer = null); + + /** + * Retrieves the initializer callback used to initialize the proxy. + * + * @see __setInitializer + * + * @return Closure|null + */ + public function __getInitializer(); + + /** + * Sets the callback to be used when cloning the proxy. That initializer should accept + * a single parameter, which is the cloned proxy instance itself. + * + * @param Closure|null $cloner + * + * @return void + */ + public function __setCloner(Closure $cloner = null); + + /** + * Retrieves the callback to be used when cloning the proxy. + * + * @see __setCloner + * + * @return Closure|null + */ + public function __getCloner(); + + /** + * Retrieves the list of lazy loaded properties for a given proxy + * + * @return array Keys are the property names, and values are the default values + * for those properties. + */ + public function __getLazyProperties(); +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyDefinition.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyDefinition.php new file mode 100644 index 0000000..48b149a --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyDefinition.php @@ -0,0 +1,70 @@ +. + */ + +namespace Doctrine\Common\Proxy; + +/** + * Definition structure how to create a proxy. + * + * @author Benjamin Eberlei + */ +class ProxyDefinition +{ + /** + * @var string + */ + public $proxyClassName; + + /** + * @var array + */ + public $identifierFields; + + /** + * @var \ReflectionProperty[] + */ + public $reflectionFields; + + /** + * @var callable + */ + public $initializer; + + /** + * @var callable + */ + public $cloner; + + /** + * @param string $proxyClassName + * @param array $identifierFields + * @param array $reflectionFields + * @param callable $initializer + * @param callable $cloner + */ + public function __construct($proxyClassName, array $identifierFields, array $reflectionFields, $initializer, $cloner) + { + $this->proxyClassName = $proxyClassName; + $this->identifierFields = $identifierFields; + $this->reflectionFields = $reflectionFields; + $this->initializer = $initializer; + $this->cloner = $cloner; + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php new file mode 100644 index 0000000..483ab67 --- /dev/null +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php @@ -0,0 +1,916 @@ +. + */ + +namespace Doctrine\Common\Proxy; + +use Doctrine\Common\Persistence\Mapping\ClassMetadata; +use Doctrine\Common\Util\ClassUtils; +use Doctrine\Common\Proxy\Exception\InvalidArgumentException; +use Doctrine\Common\Proxy\Exception\UnexpectedValueException; + +/** + * This factory is used to generate proxy classes. + * It builds proxies from given parameters, a template and class metadata. + * + * @author Marco Pivetta + * @since 2.4 + */ +class ProxyGenerator +{ + /** + * Used to match very simple id methods that don't need + * to be decorated since the identifier is known. + */ + const PATTERN_MATCH_ID_METHOD = '((public\s)?(function\s{1,}%s\s?\(\)\s{1,})\s{0,}{\s{0,}return\s{0,}\$this->%s;\s{0,}})i'; + + /** + * The namespace that contains all proxy classes. + * + * @var string + */ + private $proxyNamespace; + + /** + * The directory that contains all proxy classes. + * + * @var string + */ + private $proxyDirectory; + + /** + * Map of callables used to fill in placeholders set in the template. + * + * @var string[]|callable[] + */ + protected $placeholders = array( + 'baseProxyInterface' => 'Doctrine\Common\Proxy\Proxy', + 'additionalProperties' => '', + ); + + /** + * Template used as a blueprint to generate proxies. + * + * @var string + */ + protected $proxyClassTemplate = '; + +/** + * DO NOT EDIT THIS FILE - IT WAS CREATED BY DOCTRINE\'S PROXY GENERATOR + */ +class extends \ implements \ +{ + /** + * @var \Closure the callback responsible for loading properties in the proxy object. This callback is called with + * three parameters, being respectively the proxy object to be initialized, the method that triggered the + * initialization process and an array of ordered parameters that were passed to that method. + * + * @see \Doctrine\Common\Persistence\Proxy::__setInitializer + */ + public $__initializer__; + + /** + * @var \Closure the callback responsible of loading properties that need to be copied in the cloned object + * + * @see \Doctrine\Common\Persistence\Proxy::__setCloner + */ + public $__cloner__; + + /** + * @var boolean flag indicating if this object was already initialized + * + * @see \Doctrine\Common\Persistence\Proxy::__isInitialized + */ + public $__isInitialized__ = false; + + /** + * @var array properties to be lazy loaded, with keys being the property + * names and values being their default values + * + * @see \Doctrine\Common\Persistence\Proxy::__getLazyProperties + */ + public static $lazyPropertiesDefaults = array(); + + + + + + + + + + + + + + + + + + /** + * Forces initialization of the proxy + */ + public function __load() + { + $this->__initializer__ && $this->__initializer__->__invoke($this, \'__load\', array()); + } + + /** + * {@inheritDoc} + * @internal generated method: use only when explicitly handling proxy specific loading logic + */ + public function __isInitialized() + { + return $this->__isInitialized__; + } + + /** + * {@inheritDoc} + * @internal generated method: use only when explicitly handling proxy specific loading logic + */ + public function __setInitialized($initialized) + { + $this->__isInitialized__ = $initialized; + } + + /** + * {@inheritDoc} + * @internal generated method: use only when explicitly handling proxy specific loading logic + */ + public function __setInitializer(\Closure $initializer = null) + { + $this->__initializer__ = $initializer; + } + + /** + * {@inheritDoc} + * @internal generated method: use only when explicitly handling proxy specific loading logic + */ + public function __getInitializer() + { + return $this->__initializer__; + } + + /** + * {@inheritDoc} + * @internal generated method: use only when explicitly handling proxy specific loading logic + */ + public function __setCloner(\Closure $cloner = null) + { + $this->__cloner__ = $cloner; + } + + /** + * {@inheritDoc} + * @internal generated method: use only when explicitly handling proxy specific cloning logic + */ + public function __getCloner() + { + return $this->__cloner__; + } + + /** + * {@inheritDoc} + * @internal generated method: use only when explicitly handling proxy specific loading logic + * @static + */ + public function __getLazyProperties() + { + return self::$lazyPropertiesDefaults; + } + + +} +'; + + /** + * Initializes a new instance of the ProxyFactory class that is + * connected to the given EntityManager. + * + * @param string $proxyDirectory The directory to use for the proxy classes. It must exist. + * @param string $proxyNamespace The namespace to use for the proxy classes. + * + * @throws InvalidArgumentException + */ + public function __construct($proxyDirectory, $proxyNamespace) + { + if ( ! $proxyDirectory) { + throw InvalidArgumentException::proxyDirectoryRequired(); + } + + if ( ! $proxyNamespace) { + throw InvalidArgumentException::proxyNamespaceRequired(); + } + + $this->proxyDirectory = $proxyDirectory; + $this->proxyNamespace = $proxyNamespace; + } + + /** + * Sets a placeholder to be replaced in the template. + * + * @param string $name + * @param string|callable $placeholder + * + * @throws InvalidArgumentException + */ + public function setPlaceholder($name, $placeholder) + { + if ( ! is_string($placeholder) && ! is_callable($placeholder)) { + throw InvalidArgumentException::invalidPlaceholder($name); + } + + $this->placeholders[$name] = $placeholder; + } + + /** + * Sets the base template used to create proxy classes. + * + * @param string $proxyClassTemplate + */ + public function setProxyClassTemplate($proxyClassTemplate) + { + $this->proxyClassTemplate = (string) $proxyClassTemplate; + } + + /** + * Generates a proxy class file. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class Metadata for the original class. + * @param string $fileName Filename (full path) for the generated class. + * + * @throws UnexpectedValueException + */ + public function generateProxyClass(ClassMetadata $class, $fileName = null) + { + preg_match_all('(<([a-zA-Z]+)>)', $this->proxyClassTemplate, $placeholderMatches); + + $placeholderMatches = array_combine($placeholderMatches[0], $placeholderMatches[1]); + $placeholders = array(); + + foreach ($placeholderMatches as $placeholder => $name) { + $placeholders[$placeholder] = isset($this->placeholders[$name]) + ? $this->placeholders[$name] + : array($this, 'generate' . $name); + } + + foreach ($placeholders as & $placeholder) { + if (is_callable($placeholder)) { + $placeholder = call_user_func($placeholder, $class); + } + } + + $proxyCode = strtr($this->proxyClassTemplate, $placeholders); + $fileName = $fileName ?: $this->getProxyFileName($class->getName()); + $parentDirectory = dirname($fileName); + + if ( ! is_dir($parentDirectory) && (false === @mkdir($parentDirectory, 0775, true))) { + throw UnexpectedValueException::proxyDirectoryNotWritable(); + } + + if ( ! is_writable($parentDirectory)) { + throw UnexpectedValueException::proxyDirectoryNotWritable(); + } + + $tmpFileName = $fileName . '.' . uniqid('', true); + + file_put_contents($tmpFileName, $proxyCode); + rename($tmpFileName, $fileName); + } + + /** + * Generates the proxy short class name to be used in the template. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateProxyShortClassName(ClassMetadata $class) + { + $proxyClassName = ClassUtils::generateProxyClassName($class->getName(), $this->proxyNamespace); + $parts = explode('\\', strrev($proxyClassName), 2); + + return strrev($parts[0]); + } + + /** + * Generates the proxy namespace. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateNamespace(ClassMetadata $class) + { + $proxyClassName = ClassUtils::generateProxyClassName($class->getName(), $this->proxyNamespace); + $parts = explode('\\', strrev($proxyClassName), 2); + + return strrev($parts[1]); + } + + /** + * Generates the original class name. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateClassName(ClassMetadata $class) + { + return ltrim($class->getName(), '\\'); + } + + /** + * Generates the array representation of lazy loaded public properties and their default values. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateLazyPropertiesDefaults(ClassMetadata $class) + { + $lazyPublicProperties = $this->getLazyLoadedPublicProperties($class); + $values = array(); + + foreach ($lazyPublicProperties as $key => $value) { + $values[] = var_export($key, true) . ' => ' . var_export($value, true); + } + + return implode(', ', $values); + } + + /** + * Generates the constructor code (un-setting public lazy loaded properties, setting identifier field values). + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateConstructorImpl(ClassMetadata $class) + { + $constructorImpl = <<<'EOT' + /** + * @param \Closure $initializer + * @param \Closure $cloner + */ + public function __construct($initializer = null, $cloner = null) + { + +EOT; + $toUnset = array(); + + foreach ($this->getLazyLoadedPublicProperties($class) as $lazyPublicProperty => $unused) { + $toUnset[] = '$this->' . $lazyPublicProperty; + } + + $constructorImpl .= (empty($toUnset) ? '' : ' unset(' . implode(', ', $toUnset) . ");\n") + . <<<'EOT' + + $this->__initializer__ = $initializer; + $this->__cloner__ = $cloner; + } +EOT; + + return $constructorImpl; + } + + /** + * Generates the magic getter invoked when lazy loaded public properties are requested. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateMagicGet(ClassMetadata $class) + { + $lazyPublicProperties = array_keys($this->getLazyLoadedPublicProperties($class)); + $reflectionClass = $class->getReflectionClass(); + $hasParentGet = false; + $returnReference = ''; + $inheritDoc = ''; + + if ($reflectionClass->hasMethod('__get')) { + $hasParentGet = true; + $inheritDoc = '{@inheritDoc}'; + + if ($reflectionClass->getMethod('__get')->returnsReference()) { + $returnReference = '& '; + } + } + + if (empty($lazyPublicProperties) && ! $hasParentGet) { + return ''; + } + + $magicGet = <<__getLazyProperties())) { + $this->__initializer__ && $this->__initializer__->__invoke($this, '__get', array($name)); + + return $this->$name; + } + + +EOT; + } + + if ($hasParentGet) { + $magicGet .= <<<'EOT' + $this->__initializer__ && $this->__initializer__->__invoke($this, '__get', array($name)); + + return parent::__get($name); + +EOT; + } else { + $magicGet .= <<<'EOT' + trigger_error(sprintf('Undefined property: %s::$%s', __CLASS__, $name), E_USER_NOTICE); + +EOT; + } + + $magicGet .= " }"; + + return $magicGet; + } + + /** + * Generates the magic setter (currently unused). + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateMagicSet(ClassMetadata $class) + { + $lazyPublicProperties = $this->getLazyLoadedPublicProperties($class); + $hasParentSet = $class->getReflectionClass()->hasMethod('__set'); + + if (empty($lazyPublicProperties) && ! $hasParentSet) { + return ''; + } + + $inheritDoc = $hasParentSet ? '{@inheritDoc}' : ''; + $magicSet = <<__getLazyProperties())) { + $this->__initializer__ && $this->__initializer__->__invoke($this, '__set', array($name, $value)); + + $this->$name = $value; + + return; + } + + +EOT; + } + + if ($hasParentSet) { + $magicSet .= <<<'EOT' + $this->__initializer__ && $this->__initializer__->__invoke($this, '__set', array($name, $value)); + + return parent::__set($name, $value); +EOT; + } else { + $magicSet .= " \$this->\$name = \$value;"; + } + + $magicSet .= "\n }"; + + return $magicSet; + } + + /** + * Generates the magic issetter invoked when lazy loaded public properties are checked against isset(). + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateMagicIsset(ClassMetadata $class) + { + $lazyPublicProperties = array_keys($this->getLazyLoadedPublicProperties($class)); + $hasParentIsset = $class->getReflectionClass()->hasMethod('__isset'); + + if (empty($lazyPublicProperties) && ! $hasParentIsset) { + return ''; + } + + $inheritDoc = $hasParentIsset ? '{@inheritDoc}' : ''; + $magicIsset = <<__getLazyProperties())) { + $this->__initializer__ && $this->__initializer__->__invoke($this, '__isset', array($name)); + + return isset($this->$name); + } + + +EOT; + } + + if ($hasParentIsset) { + $magicIsset .= <<<'EOT' + $this->__initializer__ && $this->__initializer__->__invoke($this, '__isset', array($name)); + + return parent::__isset($name); + +EOT; + } else { + $magicIsset .= " return false;"; + } + + return $magicIsset . "\n }"; + } + + /** + * Generates implementation for the `__sleep` method of proxies. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateSleepImpl(ClassMetadata $class) + { + $hasParentSleep = $class->getReflectionClass()->hasMethod('__sleep'); + $inheritDoc = $hasParentSleep ? '{@inheritDoc}' : ''; + $sleepImpl = <<__isInitialized__) { + $properties = array_diff($properties, array_keys($this->__getLazyProperties())); + } + + return $properties; + } +EOT; + } + + $allProperties = array('__isInitialized__'); + + /* @var $prop \ReflectionProperty */ + foreach ($class->getReflectionClass()->getProperties() as $prop) { + $allProperties[] = $prop->getName(); + } + + $lazyPublicProperties = array_keys($this->getLazyLoadedPublicProperties($class)); + $protectedProperties = array_diff($allProperties, $lazyPublicProperties); + + foreach ($allProperties as &$property) { + $property = var_export($property, true); + } + + foreach ($protectedProperties as &$property) { + $property = var_export($property, true); + } + + $allProperties = implode(', ', $allProperties); + $protectedProperties = implode(', ', $protectedProperties); + + return $sleepImpl . <<__isInitialized__) { + return array($allProperties); + } + + return array($protectedProperties); + } +EOT; + } + + /** + * Generates implementation for the `__wakeup` method of proxies. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateWakeupImpl(ClassMetadata $class) + { + $unsetPublicProperties = array(); + $hasWakeup = $class->getReflectionClass()->hasMethod('__wakeup'); + + foreach (array_keys($this->getLazyLoadedPublicProperties($class)) as $lazyPublicProperty) { + $unsetPublicProperties[] = '$this->' . $lazyPublicProperty; + } + + $shortName = $this->generateProxyShortClassName($class); + $inheritDoc = $hasWakeup ? '{@inheritDoc}' : ''; + $wakeupImpl = <<__isInitialized__) { + \$this->__initializer__ = function ($shortName \$proxy) { + \$proxy->__setInitializer(null); + \$proxy->__setCloner(null); + + \$existingProperties = get_object_vars(\$proxy); + + foreach (\$proxy->__getLazyProperties() as \$property => \$defaultValue) { + if ( ! array_key_exists(\$property, \$existingProperties)) { + \$proxy->\$property = \$defaultValue; + } + } + }; + +EOT; + + if ( ! empty($unsetPublicProperties)) { + $wakeupImpl .= "\n unset(" . implode(', ', $unsetPublicProperties) . ");"; + } + + $wakeupImpl .= "\n }"; + + if ($hasWakeup) { + $wakeupImpl .= "\n parent::__wakeup();"; + } + + $wakeupImpl .= "\n }"; + + return $wakeupImpl; + } + + /** + * Generates implementation for the `__clone` method of proxies. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateCloneImpl(ClassMetadata $class) + { + $hasParentClone = $class->getReflectionClass()->hasMethod('__clone'); + $inheritDoc = $hasParentClone ? '{@inheritDoc}' : ''; + $callParentClone = $hasParentClone ? "\n parent::__clone();\n" : ''; + + return <<__cloner__ && \$this->__cloner__->__invoke(\$this, '__clone', array()); +$callParentClone } +EOT; + } + + /** + * Generates decorated methods by picking those available in the parent class. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return string + */ + private function generateMethods(ClassMetadata $class) + { + $methods = ''; + $methodNames = array(); + $reflectionMethods = $class->getReflectionClass()->getMethods(\ReflectionMethod::IS_PUBLIC); + $skippedMethods = array( + '__sleep' => true, + '__clone' => true, + '__wakeup' => true, + '__get' => true, + '__set' => true, + '__isset' => true, + ); + + foreach ($reflectionMethods as $method) { + $name = $method->getName(); + + if ( + $method->isConstructor() || + isset($skippedMethods[strtolower($name)]) || + isset($methodNames[$name]) || + $method->isFinal() || + $method->isStatic() || + ( ! $method->isPublic()) + ) { + continue; + } + + $methodNames[$name] = true; + $methods .= "\n /**\n" + . " * {@inheritDoc}\n" + . " */\n" + . ' public function '; + + if ($method->returnsReference()) { + $methods .= '&'; + } + + $methods .= $name . '('; + + $firstParam = true; + $parameterString = ''; + $argumentString = ''; + $parameters = array(); + + foreach ($method->getParameters() as $param) { + if ($firstParam) { + $firstParam = false; + } else { + $parameterString .= ', '; + $argumentString .= ', '; + } + + try { + $paramClass = $param->getClass(); + } catch (\ReflectionException $previous) { + throw UnexpectedValueException::invalidParameterTypeHint( + $class->getName(), + $method->getName(), + $param->getName(), + $previous + ); + } + + // We need to pick the type hint class too + if (null !== $paramClass) { + $parameterString .= '\\' . $paramClass->getName() . ' '; + } elseif ($param->isArray()) { + $parameterString .= 'array '; + } elseif (method_exists($param, 'isCallable') && $param->isCallable()) { + $parameterString .= 'callable '; + } + + if ($param->isPassedByReference()) { + $parameterString .= '&'; + } + + $parameters[] = '$' . $param->getName(); + $parameterString .= '$' . $param->getName(); + $argumentString .= '$' . $param->getName(); + + if ($param->isDefaultValueAvailable()) { + $parameterString .= ' = ' . var_export($param->getDefaultValue(), true); + } + } + + $methods .= $parameterString . ')'; + $methods .= "\n" . ' {' . "\n"; + + if ($this->isShortIdentifierGetter($method, $class)) { + $identifier = lcfirst(substr($name, 3)); + $fieldType = $class->getTypeOfField($identifier); + $cast = in_array($fieldType, array('integer', 'smallint')) ? '(int) ' : ''; + + $methods .= ' if ($this->__isInitialized__ === false) {' . "\n"; + $methods .= ' return ' . $cast . ' parent::' . $method->getName() . "();\n"; + $methods .= ' }' . "\n\n"; + } + + $methods .= "\n \$this->__initializer__ " + . "&& \$this->__initializer__->__invoke(\$this, " . var_export($name, true) + . ", array(" . implode(', ', $parameters) . "));" + . "\n\n return parent::" . $name . '(' . $argumentString . ');' + . "\n" . ' }' . "\n"; + } + + return $methods; + } + + /** + * Generates the Proxy file name. + * + * @param string $className + * @param string $baseDirectory Optional base directory for proxy file name generation. + * If not specified, the directory configured on the Configuration of the + * EntityManager will be used by this factory. + * + * @return string + */ + public function getProxyFileName($className, $baseDirectory = null) + { + $baseDirectory = $baseDirectory ?: $this->proxyDirectory; + + return rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . Proxy::MARKER + . str_replace('\\', '', $className) . '.php'; + } + + /** + * Checks if the method is a short identifier getter. + * + * What does this mean? For proxy objects the identifier is already known, + * however accessing the getter for this identifier usually triggers the + * lazy loading, leading to a query that may not be necessary if only the + * ID is interesting for the userland code (for example in views that + * generate links to the entity, but do not display anything else). + * + * @param \ReflectionMethod $method + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return boolean + */ + private function isShortIdentifierGetter($method, ClassMetadata $class) + { + $identifier = lcfirst(substr($method->getName(), 3)); + $startLine = $method->getStartLine(); + $endLine = $method->getEndLine(); + $cheapCheck = ( + $method->getNumberOfParameters() == 0 + && substr($method->getName(), 0, 3) == 'get' + && in_array($identifier, $class->getIdentifier(), true) + && $class->hasField($identifier) + && (($endLine - $startLine) <= 4) + ); + + if ($cheapCheck) { + $code = file($method->getDeclaringClass()->getFileName()); + $code = trim(implode(' ', array_slice($code, $startLine - 1, $endLine - $startLine + 1))); + + $pattern = sprintf(self::PATTERN_MATCH_ID_METHOD, $method->getName(), $identifier); + + if (preg_match($pattern, $code)) { + return true; + } + } + + return false; + } + + /** + * Generates the list of public properties to be lazy loaded, with their default values. + * + * @param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class + * + * @return mixed[] + */ + private function getLazyLoadedPublicProperties(ClassMetadata $class) + { + $defaultProperties = $class->getReflectionClass()->getDefaultProperties(); + $properties = array(); + + foreach ($class->getReflectionClass()->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) { + $name = $property->getName(); + + if (($class->hasField($name) || $class->hasAssociation($name)) && ! $class->isIdentifier($name)) { + $properties[$name] = $defaultProperties[$name]; + } + } + + return $properties; + } +} + diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php index ae69607..639fd69 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php @@ -31,8 +31,7 @@ * * @param string $class The name of the class. * - * @return - * The name of the class or NULL if not found. + * @return string|null 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 index b6a5fd1..418bb0f 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/Psr0FindFile.php @@ -29,14 +29,13 @@ class Psr0FindFile implements ClassFinderInterface /** * The PSR-0 prefixes. * - * @var string + * @var array */ protected $prefixes; /** - * @param string $prefixes - * An array of prefixes. Each key is a PHP namespace and each value is - * a list of directories. + * @param array $prefixes An array of prefixes. Each key is a PHP namespace and each value is + * a list of directories. */ public function __construct($prefixes) { @@ -44,12 +43,7 @@ public function __construct($prefixes) } /** - * Finds a class. - * - * @param string $class The name of the class. - * - * @return - * The name of the class or NULL if not found. + * {@inheritDoc} */ public function findFile($class) { @@ -73,11 +67,13 @@ public function findFile($class) foreach ($this->prefixes as $prefix => $dirs) { if (0 === strpos($class, $prefix)) { foreach ($dirs as $dir) { - if (file_exists($dir . DIRECTORY_SEPARATOR . $classPath)) { + if (is_file($dir . DIRECTORY_SEPARATOR . $classPath)) { return $dir . DIRECTORY_SEPARATOR . $classPath; } } } } + + return null; } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php index a436a2d..3d970ee 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/ReflectionProviderInterface.php @@ -1,5 +1,4 @@ . + */ + +namespace Doctrine\Common\Reflection; + +use ReflectionProperty; +use Doctrine\Common\Proxy\Proxy; + +/** + * PHP Runtime Reflection Public Property - special overrides for public properties. + * + * @author Marco Pivetta + * @since 2.4 + */ +class RuntimePublicReflectionProperty extends ReflectionProperty +{ + /** + * {@inheritDoc} + * + * Checks is the value actually exist before fetching it. + * This is to avoid calling `__get` on the provided $object if it + * is a {@see \Doctrine\Common\Proxy\Proxy}. + */ + public function getValue($object = null) + { + $name = $this->getName(); + + if ($object instanceof Proxy && ! $object->__isInitialized()) { + $originalInitializer = $object->__getInitializer(); + $object->__setInitializer(null); + $val = isset($object->$name) ? $object->$name : null; + $object->__setInitializer($originalInitializer); + + return $val; + } + + return isset($object->$name) ? parent::getValue($object) : null; + } + + /** + * {@inheritDoc} + * + * Avoids triggering lazy loading via `__set` if the provided object + * is a {@see \Doctrine\Common\Proxy\Proxy}. + * @link https://bugs.php.net/bug.php?id=63463 + */ + public function setValue($object, $value = null) + { + if ( ! ($object instanceof Proxy && ! $object->__isInitialized())) { + parent::setValue($object, $value); + + return; + } + + $originalInitializer = $object->__getInitializer(); + $object->__setInitializer(null); + parent::setValue($object, $value); + $object->__setInitializer($originalInitializer); + } +} diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php index 12e45d5..b65979a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionClass.php @@ -31,82 +31,403 @@ class StaticReflectionClass extends ReflectionClass */ private $staticReflectionParser; + /** + * @param StaticReflectionParser $staticReflectionParser + */ public function __construct(StaticReflectionParser $staticReflectionParser) { $this->staticReflectionParser = $staticReflectionParser; } + /** + * {@inheritDoc} + */ public function getName() { return $this->staticReflectionParser->getClassName(); } + /** + * {@inheritDoc} + */ public function getDocComment() { return $this->staticReflectionParser->getDocComment(); } + /** + * {@inheritDoc} + */ public function getNamespaceName() { return $this->staticReflectionParser->getNamespaceName(); } + /** + * @return array + */ public function getUseStatements() { return $this->staticReflectionParser->getUseStatements(); } + /** + * {@inheritDoc} + */ public function getMethod($name) { return $this->staticReflectionParser->getReflectionMethod($name); } + /** + * {@inheritDoc} + */ 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'); } + /** + * {@inheritDoc} + */ + public static function export($argument, $return = false) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstants() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getDefaultProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getEndLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtension() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtensionName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getFileName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaceNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getInterfaces() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getMethods($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getModifiers() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getParentClass() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getProperties($filter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getShortName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStartLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticProperties() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticPropertyValue($name, $default = '') + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitAliases() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraitNames() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getTraits() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasConstant($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasMethod($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function hasProperty($name) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function implementsInterface($interface) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function inNamespace() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isAbstract() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isCloneable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isFinal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstance($object) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInstantiable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInterface() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInternal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isIterateable() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isSubclassOf($class) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isTrait() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isUserDefined() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstance($args) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceArgs(array $args = array()) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function newInstanceWithoutConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function setStaticPropertyValue($name, $value) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + 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 index 6482036..311e130 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionMethod.php @@ -38,66 +38,325 @@ class StaticReflectionMethod extends ReflectionMethod */ protected $methodName; + /** + * @param StaticReflectionParser $staticReflectionParser + * @param string $methodName + */ public function __construct(StaticReflectionParser $staticReflectionParser, $methodName) { $this->staticReflectionParser = $staticReflectionParser; $this->methodName = $methodName; } + + /** + * {@inheritDoc} + */ public function getName() { return $this->methodName; } + + /** + * @return StaticReflectionParser + */ protected function getStaticReflectionParser() { return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('method', $this->methodName); } + + /** + * {@inheritDoc} + */ public function getDeclaringClass() { return $this->getStaticReflectionParser()->getReflectionClass(); } + + /** + * {@inheritDoc} + */ public function getNamespaceName() { return $this->getStaticReflectionParser()->getNamespaceName(); } + + /** + * {@inheritDoc} + */ public function getDocComment() { return $this->getStaticReflectionParser()->getDocComment('method', $this->methodName); } + + /** + * @return array + */ 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'); } + + /** + * {@inheritDoc} + */ + public static function export($class, $name, $return = false) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getClosure($object) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getModifiers() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getPrototype() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function invoke($object, $parameter = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function invokeArgs($object, array $args) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isAbstract() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isConstructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isDestructor() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isFinal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isPrivate() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isProtected() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isPublic() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isStatic() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function setAccessible($accessible) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function __toString() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getClosureThis() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getEndLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtension() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getExtensionName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getFileName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getNumberOfParameters() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getNumberOfRequiredParameters() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getParameters() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getShortName() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStartLine() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getStaticVariables() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function inNamespace() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isClosure() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isDeprecated() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isInternal() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isUserDefined() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + 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 index 7f3e41f..22a2c96 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionParser.php @@ -29,37 +29,43 @@ */ class StaticReflectionParser implements ReflectionProviderInterface { - /** - * The name of the class. + * The fully qualified class name. * * @var string */ protected $className; /** - * TRUE if the caller only wants class annotations. + * The short class name. + * + * @var string + */ + protected $shortClassName; + + /** + * Whether the caller only wants class annotations. * * @var boolean. */ protected $classAnnotationOptimize; /** - * TRUE when the parser has ran. + * Whether the parser has run. * * @var boolean */ protected $parsed = false; /** - * The namespace of the class + * The namespace of the class. * * @var string */ protected $namespace = ''; /** - * The use statements of this class. + * The use statements of the class. * * @var array */ @@ -73,7 +79,7 @@ class StaticReflectionParser implements ReflectionProviderInterface protected $docComment = array( 'class' => '', 'property' => array(), - 'method' => array(), + 'method' => array() ); /** @@ -86,31 +92,37 @@ class StaticReflectionParser implements ReflectionProviderInterface /** * The parent PSR-0 Parser. * - * @var \Doctrine\Common\Annotations\StaticReflectionParser + * @var \Doctrine\Common\Reflection\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. + * @param string $className The full, namespaced class name. + * @param ClassFinderInterface $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, '\\')) { + $lastNsPos = strrpos($this->className, '\\'); + + if ($lastNsPos !== false) { $this->namespace = substr($this->className, 0, $lastNsPos); + $this->shortClassName = substr($this->className, $lastNsPos + 1); + } else { + $this->shortClassName = $this->className; } + $this->finder = $finder; $this->classAnnotationOptimize = $classAnnotationOptimize; } + /** + * @return void + */ protected function parse() { if ($this->parsed || !$fileName = $this->finder->findFile($this->className)) { @@ -119,7 +131,7 @@ protected function parse() $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)) { + if (preg_match("/(\A.*)^\s+(abstract|final)?\s+class\s+{$this->shortClassName}\s+{/sm", $contents, $matches)) { $contents = $matches[1]; } } @@ -192,6 +204,9 @@ protected function parse() } } + /** + * @return StaticReflectionParser + */ protected function getParentStaticReflectionParser() { if (empty($this->parentStaticReflectionParser)) { @@ -201,18 +216,24 @@ protected function getParentStaticReflectionParser() return $this->parentStaticReflectionParser; } + /** + * @return string + */ public function getClassName() { return $this->className; } + /** + * @return string + */ public function getNamespaceName() { return $this->namespace; } /** - * Get the ReflectionClass equivalent for this file / class. + * {@inheritDoc} */ public function getReflectionClass() { @@ -220,7 +241,7 @@ public function getReflectionClass() } /** - * Get the ReflectionMethod equivalent for the method of this file / class. + * {@inheritDoc} */ public function getReflectionMethod($methodName) { @@ -228,7 +249,7 @@ public function getReflectionMethod($methodName) } /** - * Get the ReflectionProperty equivalent for the method of this file / class. + * {@inheritDoc} */ public function getReflectionProperty($propertyName) { @@ -236,7 +257,9 @@ public function getReflectionProperty($propertyName) } /** - * Get the use statements from this file. + * Gets the use statements from this file. + * + * @return array */ public function getUseStatements() { @@ -246,12 +269,12 @@ public function getUseStatements() } /** - * Get docComment. + * Gets the doc comment. * - * @param string $type class, property or method. - * @param string $name Name of the property or method, not needed for class. + * @param string $type The type: 'class', 'property' or 'method'. + * @param string $name The name of the property or method, not needed for 'class'. * - * @return string the doc comment or empty string if none. + * @return string The doc comment, empty string if none. */ public function getDocComment($type = 'class', $name = '') { @@ -261,12 +284,14 @@ public function getDocComment($type = 'class', $name = '') } /** - * Get the PSR-0 parser for the declaring class. + * Gets the PSR-0 parser for the declaring class. * - * @param string $type property or method. - * @param string $name Name of the property or method. + * @param string $type The type: 'property' or 'method'. + * @param string $name The name of the property or method. * * @return StaticReflectionParser A static reflection parser for the declaring class. + * + * @throws ReflectionException */ public function getStaticReflectionParserForDeclaringClass($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 index 7c6411a..1664822 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Reflection/StaticReflectionProperty.php @@ -34,44 +34,145 @@ class StaticReflectionProperty extends ReflectionProperty /** * The name of the property. * - * @var string + * @var string|null */ protected $propertyName; + /** + * @param StaticReflectionParser $staticReflectionParser + * @param string|null $propertyName + */ public function __construct(StaticReflectionParser $staticReflectionParser, $propertyName) { $this->staticReflectionParser = $staticReflectionParser; $this->propertyName = $propertyName; } + + /** + * {@inheritDoc} + */ public function getName() { return $this->propertyName; } + + /** + * @return StaticReflectionParser + */ protected function getStaticReflectionParser() { return $this->staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', $this->propertyName); } + + /** + * {@inheritDoc} + */ public function getDeclaringClass() { return $this->getStaticReflectionParser()->getReflectionClass(); } + + /** + * {@inheritDoc} + */ public function getDocComment() { return $this->getStaticReflectionParser()->getDocComment('property', $this->propertyName); } + + /** + * @return array + */ 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'); } + + /** + * {@inheritDoc} + */ + public static function export ($class, $name, $return = false) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getModifiers() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getValue($object = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isDefault() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isPrivate() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isProtected() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isPublic() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isStatic() + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function setAccessible ($accessible) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + public function setValue ($object, $value = null) + { + throw new ReflectionException('Method not implemented'); + } + + /** + * {@inheritDoc} + */ + 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 078a8db..49dc7bb 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/ClassUtils.php @@ -31,9 +31,10 @@ class ClassUtils { /** - * Get the real class name of a class name that could be a proxy. + * Gets the real class name of a class name that could be a proxy. + * + * @param string $class * - * @param string * @return string */ public static function getRealClass($class) @@ -46,9 +47,10 @@ public static function getRealClass($class) } /** - * Get the real class name of an object (even if its a proxy) + * Gets the real class name of an object (even if its a proxy). + * + * @param object $object * - * @param object * @return string */ public static function getClass($object) @@ -57,9 +59,10 @@ public static function getClass($object) } /** - * Get the real parent class name of a class or object + * Gets the real parent class name of a class or object. + * + * @param string $className * - * @param string * @return string */ public static function getParentClass($className) @@ -68,9 +71,10 @@ public static function getParentClass($className) } /** - * Create a new reflection class + * Creates a new reflection class. + * + * @param string $class * - * @param string * @return \ReflectionClass */ public static function newReflectionClass($class) @@ -79,9 +83,10 @@ public static function newReflectionClass($class) } /** - * Create a new reflection object + * Creates a new reflection object. + * + * @param object $object * - * @param object * @return \ReflectionObject */ public static function newReflectionObject($object) @@ -90,10 +95,11 @@ public static function newReflectionObject($object) } /** - * Given a class name and a proxy namespace return the proxy name. + * Given a class name and a proxy namespace returns the proxy name. * * @param string $className * @param string $proxyNamespace + * * @return string */ public static function generateProxyClassName($className, $proxyNamespace) 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 458e5c8..8f25c9a 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Debug.php @@ -19,32 +19,35 @@ namespace Doctrine\Common\Util; +use Doctrine\Common\Persistence\Proxy; + /** * Static class containing most used debug methods. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.0 - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel - * @author Giorgio Sironi + * @link www.doctrine-project.org + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + * @author Giorgio Sironi */ final class Debug { /** - * Private constructor (prevents from instantiation) - * + * Private constructor (prevents instantiation). */ - private function __construct() {} + private function __construct() + { + } /** * Prints a dump of the public, protected and private properties of $var. * * @link http://xdebug.org/ - * @param mixed $var - * @param integer $maxDepth Maximum nesting level for object properties - * @param boolean $stripTags Flag that indicate if output should strip HTML tags + * + * @param mixed $var The variable to dump. + * @param integer $maxDepth The maximum nesting level for object properties. + * @param boolean $stripTags Whether output should strip HTML tags. */ public static function dump($var, $maxDepth = 2, $stripTags = true) { @@ -67,10 +70,9 @@ public static function dump($var, $maxDepth = 2, $stripTags = true) } /** - * Export - * * @param mixed $var - * @param int $maxDepth + * @param int $maxDepth + * * @return mixed */ public static function export($var, $maxDepth) @@ -99,11 +101,15 @@ public static function export($var, $maxDepth) $reflClass = ClassUtils::newReflectionObject($var); $return->__CLASS__ = ClassUtils::getClass($var); - if ($var instanceof \Doctrine\Common\Persistence\Proxy) { + if ($var instanceof Proxy) { $return->__IS_PROXY__ = true; $return->__PROXY_INITIALIZED__ = $var->__isInitialized(); } + if ($var instanceof \ArrayObject || $var instanceof \ArrayIterator) { + $return->__STORAGE__ = self::export($var->getArrayCopy(), $maxDepth - 1); + } + foreach ($reflClass->getProperties() as $reflProperty) { $name = $reflProperty->getName(); @@ -123,13 +129,14 @@ public static function export($var, $maxDepth) } /** - * Convert to string + * Returns a string representation of an object. * * @param object $obj + * * @return string */ public static function toString($obj) { - return method_exists('__toString', $obj) ? (string) $obj : get_class($obj) . '@' . spl_object_hash($obj); + return method_exists($obj, '__toString') ? (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 214ed57..082dc78 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Util/Inflector.php @@ -1,7 +1,5 @@ - * @author Jonathan H. Wage + * Kept for backwards compatibility reasons, was moved to its own component. */ -class Inflector +class Inflector extends BaseInflector { - /** - * Convert word in to the format for a Doctrine table name. Converts 'ModelName' to 'model_name' - * - * @param string $word Word to tableize - * @return string $word Tableized word - */ - public static function tableize($word) - { - return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word)); - } - - /** - * Convert a word in to the format for a Doctrine class name. Converts 'table_name' to 'TableName' - * - * @param string $word Word to classify - * @return string $word Classified word - */ - public static function classify($word) - { - return str_replace(" ", "", ucwords(strtr($word, "_-", " "))); - } - - /** - * Camelize a word. This uses the classify() method and turns the first character to lowercase - * - * @param string $word - * @return string $word - */ - public static function camelize($word) - { - return lcfirst(self::classify($word)); - } } diff --git a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php index cca4894..f23a461 100644 --- a/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php +++ b/core/vendor/doctrine/common/lib/Doctrine/Common/Version.php @@ -20,30 +20,28 @@ namespace Doctrine\Common; /** - * Class to store and retrieve the version of Doctrine + * Class to store and retrieve the version of Doctrine. * - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @link www.doctrine-project.org - * @since 2.0 - * @version $Revision$ - * @author Benjamin Eberlei - * @author Guilherme Blanco - * @author Jonathan Wage - * @author Roman Borschel + * @link www.doctrine-project.org + * @since 2.0 + * @author Benjamin Eberlei + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel */ class Version { /** - * Current Doctrine Version + * Current Doctrine Version. */ - const VERSION = '2.3.0'; + const VERSION = '2.4.1'; /** * Compares a Doctrine version with the current one. * * @param string $version Doctrine version to compare. - * @return int Returns -1 if older, 0 if it is the same, 1 if version - * passed as argument is newer. + * + * @return int -1 if older, 0 if it is the same, 1 if version passed as argument is newer. */ public static function compare($version) { diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php index 567cf91..1eb2216 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php @@ -42,4 +42,23 @@ public function testGetClassLoader() $this->assertNull(ClassLoader::getClassLoader('This\Class\Does\Not\Exist')); $cl->unregister(); } + + public function testClassExistsWithSilentAutoloader() + { + $test = $this; + $silentLoader = function ($className) use ($test) { + $test->assertSame('ClassLoaderTest\ClassE', $className); + require __DIR__ . '/ClassLoaderTest/ClassE.php'; + }; + $additionalLoader = function () use ($test) { + $test->fail('Should not call this loader, class was already loaded'); + }; + + $this->assertFalse(ClassLoader::classExists('ClassLoaderTest\ClassE')); + spl_autoload_register($silentLoader); + spl_autoload_register($additionalLoader); + $this->assertTrue(ClassLoader::classExists('ClassLoaderTest\ClassE')); + spl_autoload_unregister($additionalLoader); + spl_autoload_unregister($silentLoader); + } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/ClassE.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/ClassE.php new file mode 100644 index 0000000..f7a0811 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest/ClassE.php @@ -0,0 +1,5 @@ +getMock('Doctrine\Common\Peristence\ClassMetadata'); + $classMetadata = $this->getMock('Doctrine\Common\Persistence\ClassMetadata'); $chain = new MappingDriverChain(); @@ -93,7 +93,7 @@ public function testIsTransient() public function testDefaultDriver() { $companyDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); - $dafaultDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $defaultDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); $entityClassName = 'Doctrine\Tests\ORM\Mapping\DriverChainEntity'; $managerClassName = 'Doctrine\Tests\Models\Company\CompanyManager'; $chain = new MappingDriverChain(); @@ -105,26 +105,48 @@ public function testDefaultDriver() ->with($this->equalTo($managerClassName)) ->will($this->returnValue(false)); - $dafaultDriver->expects($this->never()) + $defaultDriver->expects($this->never()) ->method('loadMetadataForClass'); - $dafaultDriver->expects($this->once()) + $defaultDriver->expects($this->once()) ->method('isTransient') ->with($this->equalTo($entityClassName)) ->will($this->returnValue(true)); $this->assertNull($chain->getDefaultDriver()); - $chain->setDefaultDriver($dafaultDriver); + $chain->setDefaultDriver($defaultDriver); $chain->addDriver($companyDriver, 'Doctrine\Tests\Models\Company'); - $this->assertSame($dafaultDriver, $chain->getDefaultDriver()); + $this->assertSame($defaultDriver, $chain->getDefaultDriver()); $this->assertTrue($chain->isTransient($entityClassName)); $this->assertFalse($chain->isTransient($managerClassName)); } + + public function testDefaultDriverGetAllClassNames() + { + $companyDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $defaultDriver = $this->getMock('Doctrine\Common\Persistence\Mapping\Driver\MappingDriver'); + $chain = new MappingDriverChain(); + + $companyDriver->expects($this->once()) + ->method('getAllClassNames') + ->will($this->returnValue(array('Doctrine\Tests\Models\Company\Foo'))); + + $defaultDriver->expects($this->once()) + ->method('getAllClassNames') + ->will($this->returnValue(array('Other\Class'))); + + $chain->setDefaultDriver($defaultDriver); + $chain->addDriver($companyDriver, 'Doctrine\Tests\Models\Company'); + + $classNames = $chain->getAllClassNames(); + + $this->assertEquals(array('Doctrine\Tests\Models\Company\Foo', 'Other\Class'), $classNames); + } } class DriverChainEntity { -} \ No newline at end of file +} 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 bc1559a..c5a457f 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 @@ -39,6 +39,12 @@ public function testGetMetadataFor() $this->assertTrue($this->cmf->hasMetadataFor('stdClass')); } + public function testGetMetadataForAbsentClass() + { + $this->setExpectedException('Doctrine\Common\Persistence\Mapping\MappingException'); + $this->cmf->getMetadataFor(__NAMESPACE__ . '\AbsentClass'); + } + public function testGetParentMetadata() { $metadata = $this->cmf->getMetadataFor(__NAMESPACE__ . '\ChildEntity'); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/RuntimeReflectionServiceTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/RuntimeReflectionServiceTest.php index 5f06cad..767ccd6 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/RuntimeReflectionServiceTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/RuntimeReflectionServiceTest.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,8 +26,13 @@ */ class RuntimeReflectionServiceTest extends \PHPUnit_Framework_TestCase { + /** + * @var RuntimeReflectionService + */ private $reflectionService; + public $unusedPublicProperty; + public function setUp() { $this->reflectionService = new RuntimeReflectionService(); @@ -49,6 +54,12 @@ public function testGetParentClasses() $this->assertTrue(count($classes) >= 1, "The test class ".__CLASS__." should have at least one parent."); } + public function testGetParentClassesForAbsentClass() + { + $this->setExpectedException('Doctrine\Common\Persistence\Mapping\MappingException'); + $this->reflectionService->getParentClasses(__NAMESPACE__ . '\AbsentClass'); + } + public function testGetReflectionClass() { $class = $this->reflectionService->getClass(__CLASS__); @@ -65,6 +76,9 @@ public function testGetAccessibleProperty() { $reflProp = $this->reflectionService->getAccessibleProperty(__CLASS__, "reflectionService"); $this->assertInstanceOf("ReflectionProperty", $reflProp); + + $reflProp = $this->reflectionService->getAccessibleProperty(__CLASS__, "unusedPublicProperty"); + $this->assertInstanceOf("Doctrine\Common\Reflection\RuntimePublicReflectionProperty", $reflProp); } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/StaticReflectionServiceTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/StaticReflectionServiceTest.php index ffce6d4..1dd7a7a 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/StaticReflectionServiceTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/Mapping/StaticReflectionServiceTest.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/tests/Doctrine/Tests/Common/Persistence/ObjectManagerDecoratorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/ObjectManagerDecoratorTest.php new file mode 100644 index 0000000..768b4d3 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/ObjectManagerDecoratorTest.php @@ -0,0 +1,60 @@ +wrapped = $wrapped; + } +} + +class ObjectManagerDecoratorTest extends \PHPUnit_Framework_TestCase +{ + private $wrapped; + private $decorated; + + public function setUp() + { + $this->wrapped = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); + $this->decorated = new NullObjectManagerDecorator($this->wrapped); + } + + public function getMethodParameters() + { + $class = new \ReflectionClass('Doctrine\Common\Persistence\ObjectManager'); + + $methods = array(); + foreach ($class->getMethods() as $method) { + if ($method->getNumberOfRequiredParameters() === 0) { + $methods[] = array($method->getName(), array()); + } elseif ($method->getNumberOfRequiredParameters() > 0) { + $methods[] = array($method->getName(), array_fill(0, $method->getNumberOfRequiredParameters(), 'req') ?: array()); + } + if ($method->getNumberOfParameters() != $method->getNumberOfRequiredParameters()) { + $methods[] = array($method->getName(), array_fill(0, $method->getNumberOfParameters(), 'all') ?: array()); + } + } + + return $methods; + } + + /** + * @dataProvider getMethodParameters + */ + public function testAllMethodCallsAreDelegatedToTheWrappedInstance($method, array $parameters) + { + $stub = $this->wrapped + ->expects($this->once()) + ->method($method) + ->will($this->returnValue('INNER VALUE FROM ' . $method)); + + call_user_func_array(array($stub, 'with'), $parameters); + + $this->assertSame('INNER VALUE FROM ' . $method, call_user_func_array(array($this->decorated, $method), $parameters)); + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/PersistentObjectTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/PersistentObjectTest.php index a0f77b5..180d0f0 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/PersistentObjectTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Persistence/PersistentObjectTest.php @@ -84,7 +84,7 @@ public function testSetToOneAssociation() $this->assertSame($parent, $this->object->getParent($parent)); } - public function testSetInvalidToOneAssocation() + public function testSetInvalidToOneAssociation() { $parent = new \stdClass(); @@ -100,7 +100,7 @@ public function testSetToOneAssociationNull() $this->assertNull($this->object->getParent()); } - public function testAddToManyAssocation() + public function testAddToManyAssociation() { $child = new TestObject(); $this->object->addChildren($child); @@ -114,7 +114,7 @@ public function testAddToManyAssocation() $this->assertEquals(2, count($this->object->getChildren())); } - public function testAddInvalidToManyAssocation() + public function testAddInvalidToManyAssociation() { $this->setExpectedException('InvalidArgumentException'); $this->object->addChildren(new \stdClass()); diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php new file mode 100644 index 0000000..8aa966d --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AbstractProxyFactoryTest.php @@ -0,0 +1,118 @@ +getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $proxyGenerator = $this->getMock('Doctrine\Common\Proxy\ProxyGenerator', array(), array(), '', false); + + $proxyGenerator + ->expects($this->once()) + ->method('getProxyFileName'); + $proxyGenerator + ->expects($this->once()) + ->method('generateProxyClass'); + + $metadataFactory = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadataFactory'); + $proxyFactory = $this->getMockForAbstractClass( + 'Doctrine\Common\Proxy\AbstractProxyFactory', + array($proxyGenerator, $metadataFactory, true) + ); + + $proxyFactory + ->expects($this->any()) + ->method('skipClass') + ->will($this->returnValue(false)); + + $generated = $proxyFactory->generateProxyClasses(array($metadata), sys_get_temp_dir()); + + $this->assertEquals(1, $generated, 'One proxy was generated'); + } + + public function testGetProxy() + { + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $proxy = $this->getMock('Doctrine\Common\Proxy\Proxy'); + $definition = new ProxyDefinition(get_class($proxy), array(), array(), null, null); + $proxyGenerator = $this->getMock('Doctrine\Common\Proxy\ProxyGenerator', array(), array(), '', false); + $metadataFactory = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadataFactory'); + + $metadataFactory + ->expects($this->once()) + ->method('getMetadataFor') + ->will($this->returnValue($metadata)); + + $proxyFactory = $this->getMockForAbstractClass( + 'Doctrine\Common\Proxy\AbstractProxyFactory', + array($proxyGenerator, $metadataFactory, true) + ); + + $proxyFactory + ->expects($this->any()) + ->method('createProxyDefinition') + ->will($this->returnValue($definition)); + + $generatedProxy = $proxyFactory->getProxy('Class', array('id' => 1)); + + $this->assertInstanceOf(get_class($proxy), $generatedProxy); + } + + public function testResetUnitializedProxy() + { + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $proxy = $this->getMock('Doctrine\Common\Proxy\Proxy'); + $definition = new ProxyDefinition(get_class($proxy), array(), array(), null, null); + $proxyGenerator = $this->getMock('Doctrine\Common\Proxy\ProxyGenerator', array(), array(), '', false); + $metadataFactory = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadataFactory'); + + $metadataFactory + ->expects($this->once()) + ->method('getMetadataFor') + ->will($this->returnValue($metadata)); + + $proxyFactory = $this->getMockForAbstractClass( + 'Doctrine\Common\Proxy\AbstractProxyFactory', + array($proxyGenerator, $metadataFactory, true) + ); + + $proxyFactory + ->expects($this->any()) + ->method('createProxyDefinition') + ->will($this->returnValue($definition)); + + $proxy + ->expects($this->once()) + ->method('__isInitialized') + ->will($this->returnValue(false)); + $proxy + ->expects($this->once()) + ->method('__setInitializer'); + $proxy + ->expects($this->once()) + ->method('__setCloner'); + + $proxyFactory->resetUninitializedProxy($proxy); + } + + public function testDisallowsResettingInitializedProxy() + { + $proxyFactory = $this->getMockForAbstractClass('Doctrine\Common\Proxy\AbstractProxyFactory', array(), '', false); + $proxy = $this->getMock('Doctrine\Common\Proxy\Proxy'); + + $proxy + ->expects($this->any()) + ->method('__isInitialized') + ->will($this->returnValue(true)); + + $this->setExpectedException('Doctrine\Common\Proxy\Exception\InvalidArgumentException'); + + $proxyFactory->resetUninitializedProxy($proxy); + } +} + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AutoloaderTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AutoloaderTest.php new file mode 100644 index 0000000..be713fc --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/AutoloaderTest.php @@ -0,0 +1,72 @@ +. + */ + +namespace Doctrine\Tests\Common\Proxy; + +use PHPUnit_Framework_TestCase; +use Doctrine\Common\Proxy\Autoloader; + +/** + * @group DDC-1698 + */ +class AutoloaderTest extends PHPUnit_Framework_TestCase +{ + public static function dataResolveFile() + { + return array( + array('/tmp', 'MyProxy', 'MyProxy\__CG__\RealClass', '/tmp' . DIRECTORY_SEPARATOR . '__CG__RealClass.php'), + array('/tmp', 'MyProxy\Subdir', 'MyProxy\Subdir\__CG__\RealClass', '/tmp' . DIRECTORY_SEPARATOR . '__CG__RealClass.php'), + array('/tmp', 'MyProxy', 'MyProxy\__CG__\Other\RealClass', '/tmp' . DIRECTORY_SEPARATOR . '__CG__OtherRealClass.php'), + ); + } + + /** + * @dataProvider dataResolveFile + */ + public function testResolveFile($proxyDir, $proxyNamespace, $className, $expectedProxyFile) + { + $actualProxyFile = Autoloader::resolveFile($proxyDir, $proxyNamespace, $className); + $this->assertEquals($expectedProxyFile, $actualProxyFile); + } + + public function testAutoload() + { + if (file_exists(sys_get_temp_dir() ."/AutoloaderTestClass.php")) { + unlink(sys_get_temp_dir() ."/AutoloaderTestClass.php"); + } + + $autoloader = Autoloader::register(sys_get_temp_dir(), 'ProxyAutoloaderTest', function($proxyDir, $proxyNamespace, $className) { + file_put_contents(sys_get_temp_dir() . "/AutoloaderTestClass.php", "assertTrue(class_exists('ProxyAutoloaderTest\AutoloaderTestClass', true)); + unlink(sys_get_temp_dir() ."/AutoloaderTestClass.php"); + } + + public function testRegisterWithInvalidCallback() + { + $this->setExpectedException( + 'Doctrine\Common\Proxy\Exception\InvalidArgumentException', + 'Invalid \$notFoundCallback given: must be a callable, "stdClass" given' + ); + + Autoloader::register('', '', new \stdClass()); + } +} + diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/CallableTypeHintClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/CallableTypeHintClass.php new file mode 100644 index 0000000..f5fccb0 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/CallableTypeHintClass.php @@ -0,0 +1,16 @@ +. + */ + +namespace Doctrine\Tests\Common\Proxy; + +/** + * Test asset representing a lazy loadable object + * + * @author Marco Pivetta + * @since 2.4 + */ +class LazyLoadableObject +{ + /** + * @var string + */ + public $publicIdentifierField; + + /** + * @var string + */ + protected $protectedIdentifierField; + + /** + * @var string + */ + public $publicTransientField = 'publicTransientFieldValue'; + + /** + * @var string + */ + protected $protectedTransientField = 'protectedTransientFieldValue'; + + /** + * @var string + */ + public $publicPersistentField = 'publicPersistentFieldValue'; + + /** + * @var string + */ + protected $protectedPersistentField = 'protectedPersistentFieldValue'; + + /** + * @var string + */ + public $publicAssociation = 'publicAssociationValue'; + + /** + * @var string + */ + protected $protectedAssociation = 'protectedAssociationValue'; + + /** + * @return string + */ + public function getProtectedIdentifierField() + { + return $this->protectedIdentifierField; + } + + /** + * @return string + */ + public function testInitializationTriggeringMethod() + { + return 'testInitializationTriggeringMethod'; + } + + /** + * @return string + */ + public function getProtectedAssociation() + { + return $this->protectedAssociation; + } + + /** + * @param \stdClass $param + */ + public function publicTypeHintedMethod(\stdClass $param) + { + } + + /** + * + */ + public function &byRefMethod() + { + } + + /** + * @param mixed $thisIsNotByRef + * @param &mixed $thisIsByRef + */ + public function byRefParamMethod($thisIsNotByRef, &$thisIsByRef) + { + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/LazyLoadableObjectClassMetadata.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/LazyLoadableObjectClassMetadata.php new file mode 100644 index 0000000..167386e --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/LazyLoadableObjectClassMetadata.php @@ -0,0 +1,195 @@ +. + */ + +namespace Doctrine\Tests\Common\Proxy; + +use ReflectionClass; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; + +/** + * Class metadata test asset for @see LazyLoadableObject + * + * @author Marco Pivetta + * @since 2.4 + */ +class LazyLoadableObjectClassMetadata implements ClassMetadata +{ + /** + * @var ReflectionClass + */ + protected $reflectionClass; + + /** + * @var array + */ + protected $identifier = array( + 'publicIdentifierField' => true, + 'protectedIdentifierField' => true, + ); + + /** + * @var array + */ + protected $fields = array( + 'publicIdentifierField' => true, + 'protectedIdentifierField' => true, + 'publicPersistentField' => true, + 'protectedPersistentField' => true, + ); + + /** + * @var array + */ + protected $associations = array( + 'publicAssociation' => true, + 'protectedAssociation' => true, + ); + + /** + * {@inheritDoc} + */ + public function getName() + { + return $this->getReflectionClass()->getName(); + } + + /** + * {@inheritDoc} + */ + public function getIdentifier() + { + return array_keys($this->identifier); + } + + /** + * {@inheritDoc} + */ + public function getReflectionClass() + { + if (null === $this->reflectionClass) { + $this->reflectionClass = new \ReflectionClass(__NAMESPACE__ . '\LazyLoadableObject'); + } + + return $this->reflectionClass; + } + + /** + * {@inheritDoc} + */ + public function isIdentifier($fieldName) + { + return isset($this->identifier[$fieldName]); + } + + /** + * {@inheritDoc} + */ + public function hasField($fieldName) + { + return isset($this->fields[$fieldName]); + } + + /** + * {@inheritDoc} + */ + public function hasAssociation($fieldName) + { + return isset($this->associations[$fieldName]); + } + + /** + * {@inheritDoc} + */ + public function isSingleValuedAssociation($fieldName) + { + throw new \BadMethodCallException('not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isCollectionValuedAssociation($fieldName) + { + throw new \BadMethodCallException('not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getFieldNames() + { + return array_keys($this->fields); + } + + /** + * {@inheritDoc} + */ + public function getIdentifierFieldNames() + { + return $this->getIdentifier(); + } + + /** + * {@inheritDoc} + */ + public function getAssociationNames() + { + return array_keys($this->associations); + } + + /** + * {@inheritDoc} + */ + public function getTypeOfField($fieldName) + { + return 'string'; + } + + /** + * {@inheritDoc} + */ + public function getAssociationTargetClass($assocName) + { + throw new \BadMethodCallException('not implemented'); + } + + /** + * {@inheritDoc} + */ + public function isAssociationInverseSide($assocName) + { + throw new \BadMethodCallException('not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getAssociationMappedByTargetField($assocName) + { + throw new \BadMethodCallException('not implemented'); + } + + /** + * {@inheritDoc} + */ + public function getIdentifierValues($object) + { + throw new \BadMethodCallException('not implemented'); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicCloneClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicCloneClass.php new file mode 100644 index 0000000..33b983d --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicCloneClass.php @@ -0,0 +1,37 @@ +clonedValue = 'newClonedValue'; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicGetByRefClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicGetByRefClass.php new file mode 100644 index 0000000..6adf1f5 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicGetByRefClass.php @@ -0,0 +1,51 @@ +. + */ + +namespace Doctrine\Tests\Common\Proxy; + +use InvalidArgumentException; + +/** + * Test asset class + * + * @since 2.4 + */ +class MagicGetByRefClass +{ + /** + * @var mixed + */ + public $valueField; + + /** + * @param string $name + * + * @return mixed + * + * @throws \InvalidArgumentException + */ + public function & __get($name) + { + if ($name === 'value') { + return $this->valueField; + } + + throw new InvalidArgumentException(); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicGetClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicGetClass.php new file mode 100644 index 0000000..0cab36a --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicGetClass.php @@ -0,0 +1,38 @@ +testAttribute = $value; + } + + if ($name === 'publicField' || $name === 'id') { + throw new \BadMethodCallException('Should never be called for "publicField" or "id"'); + } + + $this->testAttribute = $value; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicSleepClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicSleepClass.php new file mode 100644 index 0000000..3934a05 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/MagicSleepClass.php @@ -0,0 +1,37 @@ +wakeupValue = 'newWakeupValue'; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php new file mode 100644 index 0000000..e0c21ee --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyClassGeneratorTest.php @@ -0,0 +1,185 @@ +. + */ + + +namespace Doctrine\Tests\Common\Proxy; + +use Doctrine\Common\Proxy\ProxyGenerator; +use ReflectionClass; +use ReflectionMethod; +use PHPUnit_Framework_TestCase; + +/** + * Test the proxy generator. Its work is generating on-the-fly subclasses of a given model, which implement the Proxy + * pattern. + * + * @author Giorgio Sironi + * @author Marco Pivetta + */ +class ProxyClassGeneratorTest extends PHPUnit_Framework_TestCase +{ + /** + * @var string + */ + protected $proxyClass = 'Doctrine\Tests\Common\ProxyProxy\__CG__\Doctrine\Tests\Common\Proxy\LazyLoadableObject'; + + /** + * @var LazyLoadableObjectClassMetadata + */ + protected $metadata; + + /** + * @var ProxyGenerator + */ + protected $proxyGenerator; + + /** + * {@inheritDoc} + */ + protected function setUp() + { + $this->metadata = new LazyLoadableObjectClassMetadata(); + $this->proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + + if (class_exists($this->proxyClass, false)) { + return; + } + + $this->proxyGenerator->generateProxyClass($this->metadata); + require_once $this->proxyGenerator->getProxyFileName($this->metadata->getName()); + } + + public function testReferenceProxyRespectsMethodsParametersTypeHinting() + { + $method = new ReflectionMethod($this->proxyClass, 'publicTypeHintedMethod'); + $params = $method->getParameters(); + + $this->assertEquals(1, count($params)); + $this->assertEquals('stdClass', $params[0]->getClass()->getName()); + } + + public function testProxyRespectsMethodsWhichReturnValuesByReference() + { + $method = new ReflectionMethod($this->proxyClass, 'byRefMethod'); + + $this->assertTrue($method->returnsReference()); + } + + public function testProxyRespectsByRefMethodParameters() + { + $method = new ReflectionMethod($this->proxyClass, 'byRefParamMethod'); + $parameters = $method->getParameters(); + $this->assertSame('thisIsNotByRef', $parameters[0]->getName()); + $this->assertFalse($parameters[0]->isPassedByReference()); + $this->assertSame('thisIsByRef', $parameters[1]->getName()); + $this->assertTrue($parameters[1]->isPassedByReference()); + } + + public function testCreatesAssociationProxyAsSubclassOfTheOriginalOne() + { + $this->assertTrue(is_subclass_of($this->proxyClass, $this->metadata->getName())); + } + + public function testNonNamespacedProxyGeneration() + { + $classCode = file_get_contents($this->proxyGenerator->getProxyFileName($this->metadata->getName())); + + $this->assertNotContains("class LazyLoadableObject extends \\\\" . $this->metadata->getName(), $classCode); + $this->assertContains("class LazyLoadableObject extends \\" . $this->metadata->getName(), $classCode); + } + + public function testClassWithSleepProxyGeneration() + { + if (!class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\SleepClass', false)) { + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $reflClass = new ReflectionClass('Doctrine\Tests\Common\Proxy\SleepClass'); + $metadata->expects($this->any())->method('getReflectionClass')->will($this->returnValue($reflClass)); + $metadata->expects($this->any())->method('getIdentifierFieldNames')->will($this->returnValue(array('id'))); + $metadata->expects($this->any())->method('getName')->will($this->returnValue($reflClass->getName())); + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + $proxyGenerator->generateProxyClass($metadata); + require_once $proxyGenerator->getProxyFileName($metadata->getName()); + } + + $classCode = file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxySleepClass.php'); + $this->assertEquals(1, substr_count($classCode, 'function __sleep')); + $this->assertEquals(1, substr_count($classCode, 'parent::__sleep()')); + } + + public function testClassWithCallableTypeHintOnProxiedMethod() + { + if (PHP_VERSION_ID < 50400) { + $this->markTestSkipped('`callable` is only supported in PHP >=5.4.0'); + } + + if (!class_exists('Doctrine\Tests\Common\ProxyProxy\__CG__\CallableTypeHintClass', false)) { + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $reflClass = new ReflectionClass('Doctrine\Tests\Common\Proxy\CallableTypeHintClass'); + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + + $metadata->expects($this->any())->method('getReflectionClass')->will($this->returnValue($reflClass)); + $metadata->expects($this->any())->method('getIdentifierFieldNames')->will($this->returnValue(array('id'))); + $metadata->expects($this->any())->method('getName')->will($this->returnValue($reflClass->getName())); + + $proxyGenerator->generateProxyClass($metadata); + require_once $proxyGenerator->getProxyFileName($metadata->getName()); + } + + $classCode = file_get_contents(__DIR__ . '/generated/__CG__DoctrineTestsCommonProxyCallableTypeHintClass.php'); + + $this->assertEquals(1, substr_count($classCode, 'call(callable $foo)')); + } + + public function testClassWithInvalidTypeHintOnProxiedMethod() + { + $className = 'Doctrine\Tests\Common\Proxy\InvalidTypeHintClass'; + $metadata = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadata'); + $reflClass = new ReflectionClass($className); + $metadata->expects($this->any())->method('getReflectionClass')->will($this->returnValue($reflClass)); + $metadata->expects($this->any())->method('getIdentifierFieldNames')->will($this->returnValue(array())); + $metadata->expects($this->any())->method('getName')->will($this->returnValue($className)); + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + + $this->setExpectedException( + 'Doctrine\Common\Proxy\Exception\UnexpectedValueException', + 'The type hint of parameter "foo" in method "invalidTypeHintMethod"' + .' in class "' . $className . '" is invalid.' + ); + $proxyGenerator->generateProxyClass($metadata); + } + + public function testNoConfigDirThrowsException() + { + $this->setExpectedException('Doctrine\Common\Proxy\Exception\InvalidArgumentException'); + new ProxyGenerator(null, null); + } + + public function testNoNamespaceThrowsException() + { + $this->setExpectedException('Doctrine\Common\Proxy\Exception\InvalidArgumentException'); + new ProxyGenerator(__DIR__ . '/generated', null); + } + + public function testInvalidPlaceholderThrowsException() + { + $this->setExpectedException('Doctrine\Common\Proxy\Exception\InvalidArgumentException'); + $generator = new ProxyGenerator(__DIR__ . '/generated', 'SomeNamespace'); + $generator->setPlaceholder('', array()); + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php new file mode 100644 index 0000000..9a5173c --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyLogicTest.php @@ -0,0 +1,696 @@ +. + */ + +namespace Doctrine\Tests\Common\Proxy; + +use Doctrine\Common\Proxy\ProxyGenerator; +use Doctrine\Common\Proxy\Proxy; +use Doctrine\Common\Proxy\Exception\UnexpectedValueException; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; +use PHPUnit_Framework_TestCase; + +/** + * Test the generated proxies behavior. These tests make assumptions about the structure of LazyLoadableObject + * + * @author Marco Pivetta + */ +class ProxyLogicTest extends PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $proxyLoader; + + /** + * @var ClassMetadata + */ + protected $lazyLoadableObjectMetadata; + + /** + * @var LazyLoadableObject|Proxy + */ + protected $lazyObject; + + protected $identifier = array( + 'publicIdentifierField' => 'publicIdentifierFieldValue', + 'protectedIdentifierField' => 'protectedIdentifierFieldValue', + ); + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|Callable + */ + protected $initializerCallbackMock; + + /** + * {@inheritDoc} + */ + public function setUp() + { + $this->proxyLoader = $loader = $this->getMock('stdClass', array('load'), array(), '', false); + $this->initializerCallbackMock = $this->getMock('stdClass', array('__invoke')); + $identifier = $this->identifier; + $this->lazyLoadableObjectMetadata = $metadata = new LazyLoadableObjectClassMetadata(); + + // emulating what should happen in a proxy factory + $cloner = function (LazyLoadableObject $proxy) use ($loader, $identifier, $metadata) { + /* @var $proxy LazyLoadableObject|Proxy */ + if ($proxy->__isInitialized()) { + return; + } + + $proxy->__setInitialized(true); + $proxy->__setInitializer(null); + $original = $loader->load($identifier); + + if (null === $original) { + throw new UnexpectedValueException(); + } + + foreach ($metadata->getReflectionClass()->getProperties() as $reflProperty) { + $propertyName = $reflProperty->getName(); + + if ($metadata->hasField($propertyName) || $metadata->hasAssociation($propertyName)) { + $reflProperty->setAccessible(true); + $reflProperty->setValue($proxy, $reflProperty->getValue($original)); + } + } + }; + + $proxyClassName = 'Doctrine\Tests\Common\ProxyProxy\__CG__\Doctrine\Tests\Common\Proxy\LazyLoadableObject'; + + // creating the proxy class + if (!class_exists($proxyClassName, false)) { + $proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . 'Proxy', true); + $proxyGenerator->generateProxyClass($metadata); + require_once $proxyGenerator->getProxyFileName($metadata->getName()); + } + + $this->lazyObject = new $proxyClassName($this->getClosure($this->initializerCallbackMock), $cloner); + + // setting identifiers in the proxy via reflection + foreach ($metadata->getIdentifierFieldNames() as $idField) { + $prop = $metadata->getReflectionClass()->getProperty($idField); + $prop->setAccessible(true); + $prop->setValue($this->lazyObject, $identifier[$idField]); + } + + $this->assertFalse($this->lazyObject->__isInitialized()); + } + + public function testFetchingPublicIdentifierDoesNotCauseLazyLoading() + { + $this->configureInitializerMock(0); + + $this->assertSame('publicIdentifierFieldValue', $this->lazyObject->publicIdentifierField); + } + + public function testFetchingIdentifiersViaPublicGetterDoesNotCauseLazyLoading() + { + $this->configureInitializerMock(0); + + $this->assertSame('protectedIdentifierFieldValue', $this->lazyObject->getProtectedIdentifierField()); + } + + public function testCallingMethodCausesLazyLoading() + { + $this->configureInitializerMock( + 1, + array($this->lazyObject, 'testInitializationTriggeringMethod', array()), + function (Proxy $proxy) { + $proxy->__setInitializer(null); + } + ); + + $this->lazyObject->testInitializationTriggeringMethod(); + $this->lazyObject->testInitializationTriggeringMethod(); + } + + public function testFetchingPublicFieldsCausesLazyLoading() + { + $test = $this; + $this->configureInitializerMock( + 1, + array($this->lazyObject, '__get', array('publicPersistentField')), + function () use ($test) { + $test->setProxyValue('publicPersistentField', 'loadedValue'); + } + ); + + $this->assertSame('loadedValue', $this->lazyObject->publicPersistentField); + $this->assertSame('loadedValue', $this->lazyObject->publicPersistentField); + } + + public function testFetchingPublicAssociationCausesLazyLoading() + { + $test = $this; + $this->configureInitializerMock( + 1, + array($this->lazyObject, '__get', array('publicAssociation')), + function () use ($test) { + $test->setProxyValue('publicAssociation', 'loadedAssociation'); + } + ); + + $this->assertSame('loadedAssociation', $this->lazyObject->publicAssociation); + $this->assertSame('loadedAssociation', $this->lazyObject->publicAssociation); + } + + public function testFetchingProtectedAssociationViaPublicGetterCausesLazyLoading() + { + $this->configureInitializerMock( + 1, + array($this->lazyObject, 'getProtectedAssociation', array()), + function (Proxy $proxy) { + $proxy->__setInitializer(null); + } + ); + + $this->assertSame('protectedAssociationValue', $this->lazyObject->getProtectedAssociation()); + $this->assertSame('protectedAssociationValue', $this->lazyObject->getProtectedAssociation()); + } + + public function testLazyLoadingTriggeredOnlyAtFirstPublicPropertyRead() + { + $test = $this; + $this->configureInitializerMock( + 1, + array($this->lazyObject, '__get', array('publicPersistentField')), + function () use ($test) { + $test->setProxyValue('publicPersistentField', 'loadedValue'); + $test->setProxyValue('publicAssociation', 'publicAssociationValue'); + } + ); + + $this->assertSame('loadedValue', $this->lazyObject->publicPersistentField); + $this->assertSame('publicAssociationValue', $this->lazyObject->publicAssociation); + } + + public function testNoticeWhenReadingNonExistentPublicProperties() + { + $this->configureInitializerMock(0); + + $class = get_class($this->lazyObject); + $this->setExpectedException( + 'PHPUnit_Framework_Error_Notice', + 'Undefined property: ' . $class . '::$non_existing_property' + ); + + $this->lazyObject->non_existing_property; + } + + public function testFalseWhenCheckingNonExistentProperty() + { + $this->configureInitializerMock(0); + + $this->assertFalse(isset($this->lazyObject->non_existing_property)); + } + + public function testNoErrorWhenSettingNonExistentProperty() + { + $this->configureInitializerMock(0); + + $this->lazyObject->non_existing_property = 'now has a value'; + $this->assertSame('now has a value', $this->lazyObject->non_existing_property); + } + + public function testCloningCallsClonerWithClonedObject() + { + $lazyObject = $this->lazyObject; + $test = $this; + $cb = $this->getMock('stdClass', array('cb')); + $cb + ->expects($this->once()) + ->method('cb') + ->will($this->returnCallback(function (LazyLoadableObject $proxy) use ($lazyObject, $test) { + /* @var $proxy LazyLoadableObject|Proxy */ + $test->assertNotSame($proxy, $lazyObject); + $proxy->__setInitializer(null); + $proxy->publicAssociation = 'clonedAssociation'; + })); + + $this->lazyObject->__setCloner($this->getClosure(array($cb, 'cb'))); + + $cloned = clone $this->lazyObject; + $this->assertSame('clonedAssociation', $cloned->publicAssociation); + $this->assertNotSame($cloned, $lazyObject, 'a clone of the lazy object is retrieved'); + } + + public function testFetchingTransientPropertiesWillNotTriggerLazyLoading() + { + $this->configureInitializerMock(0); + + $this->assertSame( + 'publicTransientFieldValue', + $this->lazyObject->publicTransientField, + 'fetching public transient field won\'t trigger lazy loading' + ); + $property = $this + ->lazyLoadableObjectMetadata + ->getReflectionClass() + ->getProperty('protectedTransientField'); + $property->setAccessible(true); + $this->assertSame( + 'protectedTransientFieldValue', + $property->getValue($this->lazyObject), + 'fetching protected transient field via reflection won\'t trigger lazy loading' + ); + } + + /** + * Provided to guarantee backwards compatibility + */ + public function testLoadProxyMethod() + { + $this->configureInitializerMock(2, array($this->lazyObject, '__load', array())); + + $this->lazyObject->__load(); + $this->lazyObject->__load(); + } + + public function testLoadingWithPersisterWillBeTriggeredOnlyOnce() + { + $this + ->proxyLoader + ->expects($this->once()) + ->method('load') + ->with( + array( + 'publicIdentifierField' => 'publicIdentifierFieldValue', + 'protectedIdentifierField' => 'protectedIdentifierFieldValue', + ), + $this->lazyObject + ) + ->will($this->returnCallback(function ($id, LazyLoadableObject $lazyObject) { + // setting a value to verify that the persister can actually set something in the object + $lazyObject->publicAssociation = $id['publicIdentifierField'] . '-test'; + return true; + })); + $this->lazyObject->__setInitializer($this->getSuggestedInitializerImplementation()); + + $this->lazyObject->__load(); + $this->lazyObject->__load(); + $this->assertSame('publicIdentifierFieldValue-test', $this->lazyObject->publicAssociation); + } + + public function testFailedLoadingWillThrowException() + { + $this->proxyLoader->expects($this->any())->method('load')->will($this->returnValue(null)); + $this->setExpectedException('UnexpectedValueException'); + $this->lazyObject->__setInitializer($this->getSuggestedInitializerImplementation()); + + $this->lazyObject->__load(); + } + + public function testCloningWithPersister() + { + $this->lazyObject->publicTransientField = 'should-not-change'; + $this + ->proxyLoader + ->expects($this->exactly(2)) + ->method('load') + ->with(array( + 'publicIdentifierField' => 'publicIdentifierFieldValue', + 'protectedIdentifierField' => 'protectedIdentifierFieldValue', + )) + ->will($this->returnCallback(function () { + $blueprint = new LazyLoadableObject(); + $blueprint->publicPersistentField = 'checked-persistent-field'; + $blueprint->publicAssociation = 'checked-association-field'; + $blueprint->publicTransientField = 'checked-transient-field'; + + return $blueprint; + })); + + $firstClone = clone $this->lazyObject; + $this->assertSame( + 'checked-persistent-field', + $firstClone->publicPersistentField, + 'Persistent fields are cloned correctly' + ); + $this->assertSame( + 'checked-association-field', + $firstClone->publicAssociation, + 'Associations are cloned correctly' + ); + $this->assertSame( + 'should-not-change', + $firstClone->publicTransientField, + 'Transient fields are not overwritten' + ); + + $secondClone = clone $this->lazyObject; + $this->assertSame( + 'checked-persistent-field', + $secondClone->publicPersistentField, + 'Persistent fields are cloned correctly' + ); + $this->assertSame( + 'checked-association-field', + $secondClone->publicAssociation, + 'Associations are cloned correctly' + ); + $this->assertSame( + 'should-not-change', + $secondClone->publicTransientField, + 'Transient fields are not overwritten' + ); + + // those should not trigger lazy loading + $firstClone->__load(); + $secondClone->__load(); + } + + public function testNotInitializedProxyUnserialization() + { + $this->configureInitializerMock(); + + $serialized = serialize($this->lazyObject); + /* @var $unserialized LazyLoadableObject|Proxy */ + $unserialized = unserialize($serialized); + $reflClass = $this->lazyLoadableObjectMetadata->getReflectionClass(); + + $this->assertFalse($unserialized->__isInitialized(), 'serialization didn\'t cause intialization'); + + // Checking identifiers + $this->assertSame('publicIdentifierFieldValue', $unserialized->publicIdentifierField, 'identifiers are kept'); + $protectedIdentifierField = $reflClass->getProperty('protectedIdentifierField'); + $protectedIdentifierField->setAccessible(true); + $this->assertSame( + 'protectedIdentifierFieldValue', + $protectedIdentifierField->getValue($unserialized), + 'identifiers are kept' + ); + + // Checking transient fields + $this->assertSame( + 'publicTransientFieldValue', + $unserialized->publicTransientField, + 'transient fields are kept' + ); + $protectedTransientField = $reflClass->getProperty('protectedTransientField'); + $protectedTransientField->setAccessible(true); + $this->assertSame( + 'protectedTransientFieldValue', + $protectedTransientField->getValue($unserialized), + 'transient fields are kept' + ); + + // Checking persistent fields + $this->assertSame( + 'publicPersistentFieldValue', + $unserialized->publicPersistentField, + 'persistent fields are kept' + ); + $protectedPersistentField = $reflClass->getProperty('protectedPersistentField'); + $protectedPersistentField->setAccessible(true); + $this->assertSame( + 'protectedPersistentFieldValue', + $protectedPersistentField->getValue($unserialized), + 'persistent fields are kept' + ); + + // Checking associations + $this->assertSame('publicAssociationValue', $unserialized->publicAssociation, 'associations are kept'); + $protectedAssociationField = $reflClass->getProperty('protectedAssociation'); + $protectedAssociationField->setAccessible(true); + $this->assertSame( + 'protectedAssociationValue', + $protectedAssociationField->getValue($unserialized), + 'associations are kept' + ); + } + + public function testInitializedProxyUnserialization() + { + // persister will retrieve the lazy object itself, so that we don't have to re-define all field values + $this->proxyLoader->expects($this->once())->method('load')->will($this->returnValue($this->lazyObject)); + $this->lazyObject->__setInitializer($this->getSuggestedInitializerImplementation()); + $this->lazyObject->__load(); + + $serialized = serialize($this->lazyObject); + $reflClass = $this->lazyLoadableObjectMetadata->getReflectionClass(); + /* @var $unserialized LazyLoadableObject|Proxy */ + $unserialized = unserialize($serialized); + + $this->assertTrue($unserialized->__isInitialized(), 'serialization didn\'t cause intialization'); + + // Checking transient fields + $this->assertSame( + 'publicTransientFieldValue', + $unserialized->publicTransientField, + 'transient fields are kept' + ); + $protectedTransientField = $reflClass->getProperty('protectedTransientField'); + $protectedTransientField->setAccessible(true); + $this->assertSame( + 'protectedTransientFieldValue', + $protectedTransientField->getValue($unserialized), + 'transient fields are kept' + ); + + // Checking persistent fields + $this->assertSame( + 'publicPersistentFieldValue', + $unserialized->publicPersistentField, + 'persistent fields are kept' + ); + $protectedPersistentField = $reflClass->getProperty('protectedPersistentField'); + $protectedPersistentField->setAccessible(true); + $this->assertSame( + 'protectedPersistentFieldValue', + $protectedPersistentField->getValue($unserialized), + 'persistent fields are kept' + ); + + // Checking identifiers + $this->assertSame( + 'publicIdentifierFieldValue', + $unserialized->publicIdentifierField, + 'identifiers are kept' + ); + $protectedIdentifierField = $reflClass->getProperty('protectedIdentifierField'); + $protectedIdentifierField->setAccessible(true); + $this->assertSame( + 'protectedIdentifierFieldValue', + $protectedIdentifierField->getValue($unserialized), + 'identifiers are kept' + ); + + // Checking associations + $this->assertSame('publicAssociationValue', $unserialized->publicAssociation, 'associations are kept'); + $protectedAssociationField = $reflClass->getProperty('protectedAssociation'); + $protectedAssociationField->setAccessible(true); + $this->assertSame( + 'protectedAssociationValue', + $protectedAssociationField->getValue($unserialized), + 'associations are kept' + ); + } + + public function testInitializationRestoresDefaultPublicLazyLoadedFieldValues() + { + // setting noop persister + $this->proxyLoader->expects($this->once())->method('load')->will($this->returnValue($this->lazyObject)); + $this->lazyObject->__setInitializer($this->getSuggestedInitializerImplementation()); + + $this->assertSame( + 'publicPersistentFieldValue', + $this->lazyObject->publicPersistentField, + 'Persistent field is restored to default value' + ); + $this->assertSame( + 'publicAssociationValue', + $this->lazyObject->publicAssociation, + 'Association is restored to default value' + ); + } + + public function testSettingPublicFieldsCausesLazyLoading() + { + $test = $this; + $this->configureInitializerMock( + 1, + array($this->lazyObject, '__set', array('publicPersistentField', 'newPublicPersistentFieldValue')), + function () use ($test) { + $test->setProxyValue('publicPersistentField', 'overrideValue'); + $test->setProxyValue('publicAssociation', 'newAssociationValue'); + } + ); + + $this->lazyObject->publicPersistentField = 'newPublicPersistentFieldValue'; + $this->assertSame('newPublicPersistentFieldValue', $this->lazyObject->publicPersistentField); + $this->assertSame('newAssociationValue', $this->lazyObject->publicAssociation); + } + + public function testSettingPublicAssociationCausesLazyLoading() + { + $test = $this; + $this->configureInitializerMock( + 1, + array($this->lazyObject, '__set', array('publicAssociation', 'newPublicAssociationValue')), + function () use ($test) { + $test->setProxyValue('publicPersistentField', 'newPublicPersistentFieldValue'); + $test->setProxyValue('publicAssociation', 'overrideValue'); + } + ); + + $this->lazyObject->publicAssociation = 'newPublicAssociationValue'; + $this->assertSame('newPublicAssociationValue', $this->lazyObject->publicAssociation); + $this->assertSame('newPublicPersistentFieldValue', $this->lazyObject->publicPersistentField); + } + + public function testCheckingPublicFieldsCausesLazyLoading() + { + $test = $this; + $this->configureInitializerMock( + 1, + array($this->lazyObject, '__isset', array('publicPersistentField')), + function () use ($test) { + $test->setProxyValue('publicPersistentField', null); + $test->setProxyValue('publicAssociation', 'setPublicAssociation'); + } + ); + + $this->assertFalse(isset($this->lazyObject->publicPersistentField)); + $this->assertNull($this->lazyObject->publicPersistentField); + $this->assertTrue(isset($this->lazyObject->publicAssociation)); + $this->assertSame('setPublicAssociation', $this->lazyObject->publicAssociation); + } + + public function testCheckingPublicAssociationCausesLazyLoading() + { + $test = $this; + $this->configureInitializerMock( + 1, + array($this->lazyObject, '__isset', array('publicAssociation')), + function () use ($test) { + $test->setProxyValue('publicPersistentField', 'newPersistentFieldValue'); + $test->setProxyValue('publicAssociation', 'setPublicAssociation'); + } + ); + + $this->assertTrue(isset($this->lazyObject->publicAssociation)); + $this->assertSame('setPublicAssociation', $this->lazyObject->publicAssociation); + $this->assertTrue(isset($this->lazyObject->publicPersistentField)); + $this->assertSame('newPersistentFieldValue', $this->lazyObject->publicPersistentField); + } + + /** + * Converts a given callable into a closure + * + * @param callable $callable + * @return \Closure + */ + public function getClosure($callable) { + return function () use ($callable) { + call_user_func_array($callable, func_get_args()); + }; + } + + /** + * Configures the current initializer callback mock with provided matcher params + * + * @param int $expectedCallCount the number of invocations to be expected. If a value< 0 is provided, `any` is used + * @param array $callParamsMatch an ordered array of parameters to be expected + * @param callable $callbackClosure a return callback closure + * + * @return \PHPUnit_Framework_MockObject_MockObject| + */ + protected function configureInitializerMock( + $expectedCallCount = 0, + array $callParamsMatch = null, + \Closure $callbackClosure = null + ) { + if (!$expectedCallCount) { + $invocationCountMatcher = $this->exactly((int) $expectedCallCount); + } else { + $invocationCountMatcher = $expectedCallCount < 0 ? $this->any() : $this->exactly($expectedCallCount); + } + + $invocationMocker = $this->initializerCallbackMock->expects($invocationCountMatcher)->method('__invoke'); + + if (null !== $callParamsMatch) { + call_user_func_array(array($invocationMocker, 'with'), $callParamsMatch); + } + + if ($callbackClosure) { + $invocationMocker->will($this->returnCallback($callbackClosure)); + } + } + + /** + * Sets a value in the current proxy object without triggering lazy loading through `__set` + * + * @link https://bugs.php.net/bug.php?id=63463 + * + * @param string $property + * @param mixed $value + */ + public function setProxyValue($property, $value) + { + $reflectionProperty = new \ReflectionProperty($this->lazyObject, $property); + $initializer = $this->lazyObject->__getInitializer(); + + // disabling initializer since setting `publicPersistentField` triggers `__set`/`__get` + $this->lazyObject->__setInitializer(null); + $reflectionProperty->setValue($this->lazyObject, $value); + $this->lazyObject->__setInitializer($initializer); + } + + /** + * Retrieves the suggested implementation of an initializer that proxy factories in O*M + * are currently following, and that should be used to initialize the current proxy object + * + * @return \Closure + */ + protected function getSuggestedInitializerImplementation() + { + $loader = $this->proxyLoader; + $identifier = $this->identifier; + + return function (LazyLoadableObject $proxy) use ($loader, $identifier) { + /* @var $proxy LazyLoadableObject|Proxy */ + $proxy->__setInitializer(null); + $proxy->__setCloner(null); + + + if ($proxy->__isInitialized()) { + return; + } + + $properties = $proxy->__getLazyProperties(); + + foreach ($properties as $propertyName => $property) { + if (!isset($proxy->$propertyName)) { + $proxy->$propertyName = $properties[$propertyName]; + } + } + + $proxy->__setInitialized(true); + + if (method_exists($proxy, '__wakeup')) { + $proxy->__wakeup(); + } + + if (null === $loader->load($identifier, $proxy)) { + throw new \UnexpectedValueException('Couldn\'t load'); + } + }; + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php new file mode 100644 index 0000000..935db31 --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/ProxyMagicMethodsTest.php @@ -0,0 +1,307 @@ +. + */ + +namespace Doctrine\Tests\Common\Proxy; + +use Doctrine\Common\Proxy\ProxyGenerator; +use Doctrine\Common\Proxy\Proxy; +use Doctrine\Common\Proxy\Exception\UnexpectedValueException; +use PHPUnit_Framework_TestCase; +use ReflectionClass; + +/** + * Test for behavior of proxies with inherited magic methods + * + * @author Marco Pivetta + */ +class ProxyMagicMethodsTest extends PHPUnit_Framework_TestCase +{ + /** + * @var \Doctrine\Common\Proxy\ProxyGenerator + */ + protected $proxyGenerator; + + /** + * @var LazyLoadableObject|Proxy + */ + protected $lazyObject; + + protected $identifier = array( + 'publicIdentifierField' => 'publicIdentifierFieldValue', + 'protectedIdentifierField' => 'protectedIdentifierFieldValue', + ); + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|Callable + */ + protected $initializerCallbackMock; + + /** + * {@inheritDoc} + */ + public function setUp() + { + $this->proxyGenerator = new ProxyGenerator(__DIR__ . '/generated', __NAMESPACE__ . '\\MagicMethodProxy'); + } + + public static function tearDownAfterClass() + { + + } + + public function testInheritedMagicGet() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\MagicGetClass'); + $proxy = new $proxyClassName( + function (Proxy $proxy, $method, $params) use (&$counter) { + if ( ! in_array($params[0], array('publicField', 'test', 'notDefined'))) { + throw new \InvalidArgumentException('Unexpected access to field "' . $params[0] . '"'); + } + + $initializer = $proxy->__getInitializer(); + + $proxy->__setInitializer(null); + + $proxy->publicField = 'modifiedPublicField'; + $counter += 1; + + $proxy->__setInitializer($initializer); + + } + ); + + $this->assertSame('id', $proxy->id); + $this->assertSame('modifiedPublicField', $proxy->publicField); + $this->assertSame('test', $proxy->test); + $this->assertSame('not defined', $proxy->notDefined); + + $this->assertSame(3, $counter); + } + + /** + * @group DCOM-194 + */ + public function testInheritedMagicGetByRef() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\MagicGetByRefClass'); + /* @var $proxy \Doctrine\Tests\Common\Proxy\MagicGetByRefClass */ + $proxy = new $proxyClassName(); + $proxy->valueField = 123; + $value = & $proxy->__get('value'); + + $this->assertSame(123, $value); + + $value = 456; + + $this->assertSame(456, $proxy->__get('value'), 'Value was fetched by reference'); + + $this->setExpectedException('InvalidArgumentException'); + + $undefined = $proxy->nonExisting; + } + + public function testInheritedMagicSet() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\MagicSetClass'); + $proxy = new $proxyClassName( + function (Proxy $proxy, $method, $params) use (&$counter) { + if ( ! in_array($params[0], array('publicField', 'test', 'notDefined'))) { + throw new \InvalidArgumentException('Unexpected access to field "' . $params[0] . '"'); + } + + $counter += 1; + } + ); + + $this->assertSame('id', $proxy->id); + + $proxy->publicField = 'publicFieldValue'; + + $this->assertSame('publicFieldValue', $proxy->publicField); + + $proxy->test = 'testValue'; + + $this->assertSame('testValue', $proxy->testAttribute); + + $proxy->notDefined = 'not defined'; + + $this->assertSame('not defined', $proxy->testAttribute); + $this->assertSame(3, $counter); + } + + public function testInheritedMagicSleep() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\MagicSleepClass'); + $proxy = new $proxyClassName(); + + $this->assertSame('defaultValue', $proxy->serializedField); + $this->assertSame('defaultValue', $proxy->nonSerializedField); + + $proxy->serializedField = 'changedValue'; + $proxy->nonSerializedField = 'changedValue'; + + $unserialized = unserialize(serialize($proxy)); + + $this->assertSame('changedValue', $unserialized->serializedField); + $this->assertSame('defaultValue', $unserialized->nonSerializedField, 'Field was not returned by "__sleep"'); + } + + public function testInheritedMagicWakeup() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\MagicWakeupClass'); + $proxy = new $proxyClassName(); + + $this->assertSame('defaultValue', $proxy->wakeupValue); + + $proxy->wakeupValue = 'changedValue'; + $unserialized = unserialize(serialize($proxy)); + + $this->assertSame('newWakeupValue', $unserialized->wakeupValue, '"__wakeup" was called'); + + $unserialized->__setInitializer(function (Proxy $proxy) { + $proxy->__setInitializer(null); + + $proxy->publicField = 'newPublicFieldValue'; + }); + + $this->assertSame('newPublicFieldValue', $unserialized->publicField, 'Proxy can still be initialized'); + } + + public function testInheritedMagicIsset() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\MagicIssetClass'); + $proxy = new $proxyClassName(function (Proxy $proxy, $method, $params) use (&$counter) { + if (in_array($params[0], array('publicField', 'test', 'nonExisting'))) { + $initializer = $proxy->__getInitializer(); + + $proxy->__setInitializer(null); + + $proxy->publicField = 'modifiedPublicField'; + $counter += 1; + + $proxy->__setInitializer($initializer); + + return; + } + + throw new \InvalidArgumentException( + sprintf('Should not be initialized when checking isset("%s")', $params[0]) + ); + }); + + $this->assertTrue(isset($proxy->id)); + $this->assertTrue(isset($proxy->publicField)); + $this->assertTrue(isset($proxy->test)); + $this->assertFalse(isset($proxy->nonExisting)); + + $this->assertSame(3, $counter); + } + + public function testInheritedMagicClone() + { + $proxyClassName = $this->generateProxyClass(__NAMESPACE__ . '\\MagicCloneClass'); + $proxy = new $proxyClassName( + null, + function ($proxy) { + $proxy->cloned = true; + } + ); + + $cloned = clone $proxy; + + $this->assertSame('newClonedValue', $cloned->clonedValue); + $this->assertFalse($proxy->cloned); + $this->assertTrue($cloned->cloned); + } + + /** + * @param $className + * + * @return string + */ + private function generateProxyClass($className) + { + $proxyClassName = 'Doctrine\\Tests\\Common\\Proxy\\MagicMethodProxy\\__CG__\\' . $className; + + if (class_exists($proxyClassName, false)) { + return $proxyClassName; + } + + $metadata = $this->getMock('Doctrine\\Common\\Persistence\\Mapping\\ClassMetadata'); + + $metadata + ->expects($this->any()) + ->method('getName') + ->will($this->returnValue($className)); + + $metadata + ->expects($this->any()) + ->method('getIdentifier') + ->will($this->returnValue(array('id'))); + + $metadata + ->expects($this->any()) + ->method('getReflectionClass') + ->will($this->returnValue(new ReflectionClass($className))); + + $metadata + ->expects($this->any()) + ->method('isIdentifier') + ->will($this->returnCallback(function ($fieldName) { + return 'id' === $fieldName; + })); + + $metadata + ->expects($this->any()) + ->method('hasField') + ->will($this->returnCallback(function ($fieldName) { + return in_array($fieldName, array('id', 'publicField')); + })); + + $metadata + ->expects($this->any()) + ->method('hasAssociation') + ->will($this->returnValue(false)); + + $metadata + ->expects($this->any()) + ->method('getFieldNames') + ->will($this->returnValue(array('id', 'publicField'))); + + $metadata + ->expects($this->any()) + ->method('getIdentifierFieldNames') + ->will($this->returnValue(array('id'))); + + $metadata + ->expects($this->any()) + ->method('getAssociationNames') + ->will($this->returnValue(array())); + + $metadata + ->expects($this->any()) + ->method('getTypeOfField') + ->will($this->returnValue('string')); + + $this->proxyGenerator->generateProxyClass($metadata); + require_once $this->proxyGenerator->getProxyFileName($className); + + return $proxyClassName; + } +} diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/SleepClass.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/SleepClass.php new file mode 100644 index 0000000..3c6ffcd --- /dev/null +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Proxy/SleepClass.php @@ -0,0 +1,19 @@ +getMock('stdClass', array('callGet')); + $getCheckMock->expects($this->never())->method('callGet'); + $initializer = function () use ($getCheckMock) { + call_user_func($getCheckMock); + }; + + $mockProxy = new RuntimePublicReflectionPropertyTestProxyMock(); + $mockProxy->__setInitializer($initializer); + + $reflProperty = new RuntimePublicReflectionProperty( + __NAMESPACE__ . '\RuntimePublicReflectionPropertyTestProxyMock', + 'checkedProperty' + ); + + $this->assertSame('testValue', $reflProperty->getValue($mockProxy)); + unset($mockProxy->checkedProperty); + $this->assertNull($reflProperty->getValue($mockProxy)); + } + + public function testSetValueOnProxyPublicProperty() + { + $setCheckMock = $this->getMock('stdClass', array('neverCallSet')); + $setCheckMock->expects($this->never())->method('neverCallSet'); + $initializer = function () use ($setCheckMock) { + call_user_func(array($setCheckMock, 'neverCallSet')); + }; + + $mockProxy = new RuntimePublicReflectionPropertyTestProxyMock(); + $mockProxy->__setInitializer($initializer); + + $reflProperty = new RuntimePublicReflectionProperty( + __NAMESPACE__ . '\RuntimePublicReflectionPropertyTestProxyMock', + 'checkedProperty' + ); + + $reflProperty->setValue($mockProxy, 'newValue'); + $this->assertSame('newValue', $mockProxy->checkedProperty); + + unset($mockProxy->checkedProperty); + $reflProperty->setValue($mockProxy, 'otherNewValue'); + $this->assertSame('otherNewValue', $mockProxy->checkedProperty); + + $setCheckMock = $this->getMock('stdClass', array('callSet')); + $setCheckMock->expects($this->once())->method('callSet'); + $initializer = function () use ($setCheckMock) { + call_user_func(array($setCheckMock, 'callSet')); + }; + + $mockProxy->__setInitializer($initializer); + $mockProxy->__setInitialized(true); + + unset($mockProxy->checkedProperty); + $reflProperty->setValue($mockProxy, 'againNewValue'); + $this->assertSame('againNewValue', $mockProxy->checkedProperty); + } +} + +/** + * Mock that simulates proxy public property lazy loading + */ +class RuntimePublicReflectionPropertyTestProxyMock implements Proxy +{ + /** + * @var \Closure|null + */ + private $initializer = null; + + /** + * @var \Closure|null + */ + private $initialized = false; + + /** + * @var string + */ + public $checkedProperty = 'testValue'; + + /** + * {@inheritDoc} + */ + public function __getInitializer() + { + return $this->initializer; + } + + /** + * {@inheritDoc} + */ + public function __setInitializer(\Closure $initializer = null) + { + $this->initializer = $initializer; + } + + /** + * {@inheritDoc} + */ + public function __getLazyProperties() + { + } + + /** + * {@inheritDoc} + */ + public function __load() + { + } + + /** + * {@inheritDoc} + */ + public function __isInitialized() + { + return $this->initialized; + } + + /** + * {@inheritDoc} + */ + public function __setInitialized($initialized) + { + $this->initialized = (bool) $initialized; + } + + /** + * @param string $name + */ + public function __get($name) + { + if ($this->initializer) { + $cb = $this->initializer; + $cb(); + } + + return $this->checkedProperty; + } + + /** + * @param string $name + * @param mixed $value + */ + public function __set($name, $value) + { + if ($this->initializer) { + $cb = $this->initializer; + $cb(); + } + + // triggers notices if `$name` is used: see https://bugs.php.net/bug.php?id=63463 + $this->checkedProperty = $value; + } + + /** + * @param string $name + * + * @return integer + */ + public function __isset($name) + { + if ($this->initializer) { + $cb = $this->initializer; + $cb(); + } + + return isset($this->checkedProperty); + } + + /** + * {@inheritDoc} + */ + public function __setCloner(\Closure $cloner = null) + { + } + + /** + * {@inheritDoc} + */ + public function __getCloner() + { + } +} \ No newline at end of file diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php index 374fdc4..a180e09 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/StaticReflectionParserTest.php @@ -8,38 +8,56 @@ class StaticReflectionParserTest extends DoctrineTestCase { - public function testParentClass() + /** + * @dataProvider classAnnotationOptimize + * + * @param bool $classAnnotationOptimize + * + * @return void + */ + public function testParentClass($classAnnotationOptimize) { $testsRoot = substr(__DIR__, 0, -strlen(__NAMESPACE__) - 1); $paths = array( 'Doctrine\\Tests' => array($testsRoot), ); $noParentClassName = 'Doctrine\\Tests\\Common\\Reflection\\NoParent'; - $staticReflectionParser = new StaticReflectionParser($noParentClassName, new Psr0FindFile($paths)); + $staticReflectionParser = new StaticReflectionParser($noParentClassName, new Psr0FindFile($paths), $classAnnotationOptimize); $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); $this->assertEquals($noParentClassName, $declaringClassName); $className = 'Doctrine\\Tests\\Common\\Reflection\\FullyClassifiedParent'; - $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); $this->assertEquals($noParentClassName, $declaringClassName); $className = 'Doctrine\\Tests\\Common\\Reflection\\SameNamespaceParent'; - $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); $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)); + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); $this->assertEquals($dummyParentClassName, $declaringClassName); $className = 'Doctrine\\Tests\\Common\\Reflection\\UseParent'; - $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths)); + $staticReflectionParser = new StaticReflectionParser($className, new Psr0FindFile($paths), $classAnnotationOptimize); $declaringClassName = $staticReflectionParser->getStaticReflectionParserForDeclaringClass('property', 'test')->getClassName(); $this->assertEquals($dummyParentClassName, $declaringClassName); } + + /** + * @return array + */ + public function classAnnotationOptimize() + { + return array( + array(false), + array(true) + ); + } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php index b4e9eed..f6fc069 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/Util/DebugTest.php @@ -24,4 +24,17 @@ public function testExportDateTime() $var = Debug::export( $obj, 2 ); $this->assertEquals( "DateTime", $var->__CLASS__ ); } + + public function testExportArrayTraversable() + { + $obj = new \ArrayObject(array('foobar')); + + $var = Debug::export($obj, 2); + $this->assertContains('foobar', $var->__STORAGE__); + + $it = new \ArrayIterator(array('foobar')); + + $var = Debug::export($it, 5); + $this->assertContains('foobar', $var->__STORAGE__); + } } diff --git a/core/vendor/doctrine/common/tests/Doctrine/Tests/TestInit.php b/core/vendor/doctrine/common/tests/Doctrine/Tests/TestInit.php index e7ab51f..07d74e6 100644 --- a/core/vendor/doctrine/common/tests/Doctrine/Tests/TestInit.php +++ b/core/vendor/doctrine/common/tests/Doctrine/Tests/TestInit.php @@ -11,14 +11,7 @@ { if (0 === strpos($class, 'Doctrine\Tests\\')) { $path = __DIR__.'/../../'.strtr($class, '\\', '/').'.php'; - if (file_exists($path) && is_readable($path)) { - require_once $path; - - return true; - } - } else if (0 === strpos($class, 'Doctrine\Common\\')) { - $path = __DIR__.'/../../../lib/'.($class = strtr($class, '\\', '/')).'.php'; - if (file_exists($path) && is_readable($path)) { + if (is_file($path) && is_readable($path)) { require_once $path; return true; @@ -26,6 +19,8 @@ } }); +require_once __DIR__ . "/../../../vendor/autoload.php"; + \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace( 'Doctrine\Tests\Common\Annotations\Fixtures', __DIR__ . '/../../' ); diff --git a/core/vendor/doctrine/common/tests/NativePhpunitTask.php b/core/vendor/doctrine/common/tests/NativePhpunitTask.php index 50fd1c3..7033283 100644 --- a/core/vendor/doctrine/common/tests/NativePhpunitTask.php +++ b/core/vendor/doctrine/common/tests/NativePhpunitTask.php @@ -16,7 +16,7 @@ /** * A more flexible and powerful PHPUnit Task than the native Phing one. * - * Plus forward compability for PHPUnit 3.5 and later is ensured by using the PHPUnit Test Runner instead of implementing one. + * Plus forward compatibility for PHPUnit 3.5 and later is ensured by using the PHPUnit Test Runner instead of implementing one. * * @author Benjamin Eberlei */ @@ -124,7 +124,7 @@ public function main() "failures (".$result->skippedCount()." skipped, ".$result->notImplementedCount()." not implemented)"); // Hudson for example doesn't like the backslash in class names - if (file_exists($this->coverageClover)) { + if (is_file($this->coverageClover)) { $this->log("Generated Clover Coverage XML to: ".$this->coverageClover); $content = file_get_contents($this->coverageClover); $content = str_replace("\\", ".", $content); diff --git a/core/vendor/doctrine/inflector/README.md b/core/vendor/doctrine/inflector/README.md new file mode 100644 index 0000000..f2d18d0 --- /dev/null +++ b/core/vendor/doctrine/inflector/README.md @@ -0,0 +1,4 @@ +# Doctrine Inflector + +Doctrine Inflector is a small library that can perform string manipulations +with regard to upper-/lowercase and singular/plural forms of words. diff --git a/core/vendor/doctrine/inflector/composer.json b/core/vendor/doctrine/inflector/composer.json new file mode 100644 index 0000000..3d3c3f9 --- /dev/null +++ b/core/vendor/doctrine/inflector/composer.json @@ -0,0 +1,21 @@ +{ + "name": "doctrine/inflector", + "type": "library", + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "keywords": ["string", "inflection", "singuarlize", "pluarlize"], + "homepage": "http://www.doctrine-project.org", + "license": "MIT", + "authors": [ + {"name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com"}, + {"name": "Roman Borschel", "email": "roman@code-factory.org"}, + {"name": "Benjamin Eberlei", "email": "kontakt@beberlei.de"}, + {"name": "Jonathan Wage", "email": "jonwage@gmail.com"}, + {"name": "Johannes Schmitt", "email": "schmittjoh@gmail.com"} + ], + "require": { + "php": ">=5.3.2" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Inflector\\": "lib/" } + } +} diff --git a/core/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php b/core/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php new file mode 100644 index 0000000..f4e38e7 --- /dev/null +++ b/core/vendor/doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php @@ -0,0 +1,385 @@ +. + */ + +namespace Doctrine\Common\Inflector; + +/** + * Doctrine inflector has static methods for inflecting text + * + * The methods in these classes are from several different sources collected + * across several different php projects and several different authors. The + * original author names and emails are not known. + * + * Plurialize & Singularize implementation are borrowed from CakePHP with some modifications. + * + * @link www.doctrine-project.org + * @since 1.0 + * @author Konsta Vesterinen + * @author Jonathan H. Wage + */ +class Inflector +{ + /** + * Plural inflector rules + * + * @var array + */ + private static $plural = array( + 'rules' => array( + '/(s)tatus$/i' => '\1\2tatuses', + '/(quiz)$/i' => '\1zes', + '/^(ox)$/i' => '\1\2en', + '/([m|l])ouse$/i' => '\1ice', + '/(matr|vert|ind)(ix|ex)$/i' => '\1ices', + '/(x|ch|ss|sh)$/i' => '\1es', + '/([^aeiouy]|qu)y$/i' => '\1ies', + '/(hive)$/i' => '\1s', + '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves', + '/sis$/i' => 'ses', + '/([ti])um$/i' => '\1a', + '/(p)erson$/i' => '\1eople', + '/(m)an$/i' => '\1en', + '/(c)hild$/i' => '\1hildren', + '/(buffal|tomat)o$/i' => '\1\2oes', + '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i', + '/us$/i' => 'uses', + '/(alias)$/i' => '\1es', + '/(ax|cris|test)is$/i' => '\1es', + '/s$/' => 's', + '/^$/' => '', + '/$/' => 's', + ), + 'uninflected' => array( + '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie' + ), + 'irregular' => array( + 'atlas' => 'atlases', + 'beef' => 'beefs', + 'brother' => 'brothers', + 'cafe' => 'cafes', + 'child' => 'children', + 'cookie' => 'cookies', + 'corpus' => 'corpuses', + 'cow' => 'cows', + 'ganglion' => 'ganglions', + 'genie' => 'genies', + 'genus' => 'genera', + 'graffito' => 'graffiti', + 'hoof' => 'hoofs', + 'loaf' => 'loaves', + 'man' => 'men', + 'money' => 'monies', + 'mongoose' => 'mongooses', + 'move' => 'moves', + 'mythos' => 'mythoi', + 'niche' => 'niches', + 'numen' => 'numina', + 'occiput' => 'occiputs', + 'octopus' => 'octopuses', + 'opus' => 'opuses', + 'ox' => 'oxen', + 'penis' => 'penises', + 'person' => 'people', + 'sex' => 'sexes', + 'soliloquy' => 'soliloquies', + 'testis' => 'testes', + 'trilby' => 'trilbys', + 'turf' => 'turfs' + ) + ); + + /** + * Singular inflector rules + * + * @var array + */ + private static $singular = array( + 'rules' => array( + '/(s)tatuses$/i' => '\1\2tatus', + '/^(.*)(menu)s$/i' => '\1\2', + '/(quiz)zes$/i' => '\\1', + '/(matr)ices$/i' => '\1ix', + '/(vert|ind)ices$/i' => '\1ex', + '/^(ox)en/i' => '\1', + '/(alias)(es)*$/i' => '\1', + '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us', + '/([ftw]ax)es/i' => '\1', + '/(cris|ax|test)es$/i' => '\1is', + '/(shoe|slave)s$/i' => '\1', + '/(o)es$/i' => '\1', + '/ouses$/' => 'ouse', + '/([^a])uses$/' => '\1us', + '/([m|l])ice$/i' => '\1ouse', + '/(x|ch|ss|sh)es$/i' => '\1', + '/(m)ovies$/i' => '\1\2ovie', + '/(s)eries$/i' => '\1\2eries', + '/([^aeiouy]|qu)ies$/i' => '\1y', + '/([lr])ves$/i' => '\1f', + '/(tive)s$/i' => '\1', + '/(hive)s$/i' => '\1', + '/(drive)s$/i' => '\1', + '/([^fo])ves$/i' => '\1fe', + '/(^analy)ses$/i' => '\1sis', + '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', + '/([ti])a$/i' => '\1um', + '/(p)eople$/i' => '\1\2erson', + '/(m)en$/i' => '\1an', + '/(c)hildren$/i' => '\1\2hild', + '/(n)ews$/i' => '\1\2ews', + '/eaus$/' => 'eau', + '/^(.*us)$/' => '\\1', + '/s$/i' => '' + ), + 'uninflected' => array( + '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', '.*ss' + ), + 'irregular' => array( + 'foes' => 'foe', + 'waves' => 'wave', + 'curves' => 'curve' + ) + ); + + /** + * Words that should not be inflected + * + * @var array + */ + private static $uninflected = array( + 'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus', + 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps', + 'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder', + 'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti', + 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings', + 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media', + 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese', + 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese', + 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors', + 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'swine', 'testes', + 'trousers', 'trout', 'tuna', 'Vermontese', 'Wenchowese', 'whiting', 'wildebeest', + 'Yengeese' + ); + + /** + * Method cache array. + * + * @var array + */ + private static $cache = array(); + + /** + * The initial state of Inflector so reset() works. + * + * @var array + */ + private static $initialState = array(); + + /** + * Convert word in to the format for a Doctrine table name. Converts 'ModelName' to 'model_name' + * + * @param string $word Word to tableize + * @return string $word Tableized word + */ + public static function tableize($word) + { + return strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $word)); + } + + /** + * Convert a word in to the format for a Doctrine class name. Converts 'table_name' to 'TableName' + * + * @param string $word Word to classify + * @return string $word Classified word + */ + public static function classify($word) + { + return str_replace(" ", "", ucwords(strtr($word, "_-", " "))); + } + + /** + * Camelize a word. This uses the classify() method and turns the first character to lowercase + * + * @param string $word + * @return string $word + */ + public static function camelize($word) + { + return lcfirst(self::classify($word)); + } + + /** + * Clears Inflectors inflected value caches. And resets the inflection + * rules to the initial values. + * + * @return void + */ + public static function reset() + { + if (empty(self::$initialState)) { + self::$initialState = get_class_vars('Inflector'); + return; + } + foreach (self::$initialState as $key => $val) { + if ($key != 'initialState') { + self::${$key} = $val; + } + } + } + + /** + * Adds custom inflection $rules, of either 'plural' or 'singular' $type. + * + * ### Usage: + * + * {{{ + * Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); + * Inflector::rules('plural', array( + * 'rules' => array('/^(inflect)ors$/i' => '\1ables'), + * 'uninflected' => array('dontinflectme'), + * 'irregular' => array('red' => 'redlings') + * )); + * }}} + * + * @param string $type The type of inflection, either 'plural' or 'singular' + * @param array $rules Array of rules to be added. + * @param boolean $reset If true, will unset default inflections for all + * new rules that are being defined in $rules. + * @return void + */ + public static function rules($type, $rules, $reset = false) + { + foreach ($rules as $rule => $pattern) { + if (is_array($pattern)) { + if ($reset) { + self::${$type}[$rule] = $pattern; + } else { + if ($rule === 'uninflected') { + self::${$type}[$rule] = array_merge($pattern, self::${$type}[$rule]); + } else { + self::${$type}[$rule] = $pattern + self::${$type}[$rule]; + } + } + unset($rules[$rule], self::${$type}['cache' . ucfirst($rule)]); + if (isset(self::${$type}['merged'][$rule])) { + unset(self::${$type}['merged'][$rule]); + } + if ($type === 'plural') { + self::$cache['pluralize'] = self::$cache['tableize'] = array(); + } elseif ($type === 'singular') { + self::$cache['singularize'] = array(); + } + } + } + self::${$type}['rules'] = $rules + self::${$type}['rules']; + } + + /** + * Return $word in plural form. + * + * @param string $word Word in singular + * @return string Word in plural + */ + public static function pluralize($word) + { + if (isset(self::$cache['pluralize'][$word])) { + return self::$cache['pluralize'][$word]; + } + + if (!isset(self::$plural['merged']['irregular'])) { + self::$plural['merged']['irregular'] = self::$plural['irregular']; + } + + if (!isset(self::$plural['merged']['uninflected'])) { + self::$plural['merged']['uninflected'] = array_merge(self::$plural['uninflected'], self::$uninflected); + } + + if (!isset(self::$plural['cacheUninflected']) || !isset(self::$plural['cacheIrregular'])) { + self::$plural['cacheUninflected'] = '(?:' . implode('|', self::$plural['merged']['uninflected']) . ')'; + self::$plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$plural['merged']['irregular'])) . ')'; + } + + if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) { + self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1); + return self::$cache['pluralize'][$word]; + } + + if (preg_match('/^(' . self::$plural['cacheUninflected'] . ')$/i', $word, $regs)) { + self::$cache['pluralize'][$word] = $word; + return $word; + } + + foreach (self::$plural['rules'] as $rule => $replacement) { + if (preg_match($rule, $word)) { + self::$cache['pluralize'][$word] = preg_replace($rule, $replacement, $word); + return self::$cache['pluralize'][$word]; + } + } + } + + /** + * Return $word in singular form. + * + * @param string $word Word in plural + * @return string Word in singular + */ + public static function singularize($word) + { + if (isset(self::$cache['singularize'][$word])) { + return self::$cache['singularize'][$word]; + } + + if (!isset(self::$singular['merged']['uninflected'])) { + self::$singular['merged']['uninflected'] = array_merge( + self::$singular['uninflected'], + self::$uninflected + ); + } + + if (!isset(self::$singular['merged']['irregular'])) { + self::$singular['merged']['irregular'] = array_merge( + self::$singular['irregular'], + array_flip(self::$plural['irregular']) + ); + } + + if (!isset(self::$singular['cacheUninflected']) || !isset(self::$singular['cacheIrregular'])) { + self::$singular['cacheUninflected'] = '(?:' . join('|', self::$singular['merged']['uninflected']) . ')'; + self::$singular['cacheIrregular'] = '(?:' . join('|', array_keys(self::$singular['merged']['irregular'])) . ')'; + } + + if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) { + self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1); + return self::$cache['singularize'][$word]; + } + + if (preg_match('/^(' . self::$singular['cacheUninflected'] . ')$/i', $word, $regs)) { + self::$cache['singularize'][$word] = $word; + return $word; + } + + foreach (self::$singular['rules'] as $rule => $replacement) { + if (preg_match($rule, $word)) { + self::$cache['singularize'][$word] = preg_replace($rule, $replacement, $word); + return self::$cache['singularize'][$word]; + } + } + self::$cache['singularize'][$word] = $word; + return $word; + } +} diff --git a/core/vendor/doctrine/inflector/phpunit.xml.dist b/core/vendor/doctrine/inflector/phpunit.xml.dist new file mode 100644 index 0000000..ef07faa --- /dev/null +++ b/core/vendor/doctrine/inflector/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + ./tests/Doctrine/ + + + + + + ./lib/Doctrine/ + + + + + + performance + + + diff --git a/core/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php b/core/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php new file mode 100644 index 0000000..487c2cd --- /dev/null +++ b/core/vendor/doctrine/inflector/tests/Doctrine/Tests/Common/Inflector/InflectorTest.php @@ -0,0 +1,185 @@ +assertEquals($singular, Inflector::singularize($plural), "'$plural' should be singularized to '$singular'"); + } + + /** + * testInflectingPlurals method + * + * @dataProvider dataSampleWords + * @return void + */ + public function testInflectingPlurals($singular, $plural) { + $this->assertEquals($plural, Inflector::pluralize($singular), "'$singular' should be pluralized to '$plural'"); + } + + /** + * testCustomPluralRule method + * + * @return void + */ + public function testCustomPluralRule() { + Inflector::reset(); + Inflector::rules('plural', array('/^(custom)$/i' => '\1izables')); + $this->assertEquals(Inflector::pluralize('custom'), 'customizables'); + + Inflector::rules('plural', array('uninflected' => array('uninflectable'))); + $this->assertEquals(Inflector::pluralize('uninflectable'), 'uninflectable'); + + Inflector::rules('plural', array( + 'rules' => array('/^(alert)$/i' => '\1ables'), + 'uninflected' => array('noflect', 'abtuse'), + 'irregular' => array('amaze' => 'amazable', 'phone' => 'phonezes') + )); + $this->assertEquals(Inflector::pluralize('noflect'), 'noflect'); + $this->assertEquals(Inflector::pluralize('abtuse'), 'abtuse'); + $this->assertEquals(Inflector::pluralize('alert'), 'alertables'); + $this->assertEquals(Inflector::pluralize('amaze'), 'amazable'); + $this->assertEquals(Inflector::pluralize('phone'), 'phonezes'); + } + + /** + * testCustomSingularRule method + * + * @return void + */ + public function testCustomSingularRule() { + Inflector::reset(); + Inflector::rules('singular', array('/(eple)r$/i' => '\1', '/(jente)r$/i' => '\1')); + + $this->assertEquals(Inflector::singularize('epler'), 'eple'); + $this->assertEquals(Inflector::singularize('jenter'), 'jente'); + + Inflector::rules('singular', array( + 'rules' => array('/^(bil)er$/i' => '\1', '/^(inflec|contribu)tors$/i' => '\1ta'), + 'uninflected' => array('singulars'), + 'irregular' => array('spins' => 'spinor') + )); + + $this->assertEquals(Inflector::singularize('inflectors'), 'inflecta'); + $this->assertEquals(Inflector::singularize('contributors'), 'contributa'); + $this->assertEquals(Inflector::singularize('spins'), 'spinor'); + $this->assertEquals(Inflector::singularize('singulars'), 'singulars'); + } + + /** + * test that setting new rules clears the inflector caches. + * + * @return void + */ + public function testRulesClearsCaches() { + Inflector::reset(); + $this->assertEquals(Inflector::singularize('Bananas'), 'Banana'); + $this->assertEquals(Inflector::pluralize('Banana'), 'Bananas'); + + Inflector::rules('singular', array( + 'rules' => array('/(.*)nas$/i' => '\1zzz') + )); + $this->assertEquals('Banazzz', Inflector::singularize('Bananas'), 'Was inflected with old rules.'); + + Inflector::rules('plural', array( + 'rules' => array('/(.*)na$/i' => '\1zzz'), + 'irregular' => array('corpus' => 'corpora') + )); + $this->assertEquals(Inflector::pluralize('Banana'), 'Banazzz', 'Was inflected with old rules.'); + $this->assertEquals(Inflector::pluralize('corpus'), 'corpora', 'Was inflected with old irregular form.'); + } + + /** + * Test resetting inflection rules. + * + * @return void + */ + public function testCustomRuleWithReset() { + Inflector::reset(); + $uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x'); + $pluralIrregular = array('as' => 'ases'); + + Inflector::rules('singular', array( + 'rules' => array('/^(.*)(a|e|o|u)is$/i' => '\1\2l'), + 'uninflected' => $uninflected, + ), true); + + Inflector::rules('plural', array( + 'rules' => array( + '/^(.*)(a|e|o|u)l$/i' => '\1\2is', + ), + 'uninflected' => $uninflected, + 'irregular' => $pluralIrregular + ), true); + + $this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois'); + $this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas'); + $this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool'); + $this->assertEquals(Inflector::singularize('Atlas'), 'Atlas'); + } +} + diff --git a/core/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php b/core/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php new file mode 100644 index 0000000..e8323d2 --- /dev/null +++ b/core/vendor/doctrine/inflector/tests/Doctrine/Tests/DoctrineTestCase.php @@ -0,0 +1,10 @@ +=5.3.2" + }, + "autoload": { + "psr-0": { "Doctrine\\Common\\Lexer\\": "lib/" } + } +} diff --git a/core/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php b/core/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php new file mode 100644 index 0000000..eb6cf7c --- /dev/null +++ b/core/vendor/doctrine/lexer/lib/Doctrine/Common/Lexer/AbstractLexer.php @@ -0,0 +1,265 @@ +. + */ + +namespace Doctrine\Common\Lexer; + +/** + * Base class for writing simple lexers, i.e. for creating small DSLs. + * + * @since 2.0 + * @author Guilherme Blanco + * @author Jonathan Wage + * @author Roman Borschel + */ +abstract class AbstractLexer +{ + /** + * @var array Array of scanned tokens + */ + private $tokens = array(); + + /** + * @var integer Current lexer position in input string + */ + private $position = 0; + + /** + * @var integer Current peek of current lexer position + */ + private $peek = 0; + + /** + * @var array The next token in the input. + */ + public $lookahead; + + /** + * @var array The last matched/seen token. + */ + public $token; + + /** + * Sets the input data to be tokenized. + * + * The Lexer is immediately reset and the new input tokenized. + * Any unprocessed tokens from any previous input are lost. + * + * @param string $input The input to be tokenized. + */ + public function setInput($input) + { + $this->tokens = array(); + $this->reset(); + $this->scan($input); + } + + /** + * Resets the lexer. + */ + public function reset() + { + $this->lookahead = null; + $this->token = null; + $this->peek = 0; + $this->position = 0; + } + + /** + * Resets the peek pointer to 0. + */ + public function resetPeek() + { + $this->peek = 0; + } + + /** + * Resets the lexer position on the input to the given position. + * + * @param integer $position Position to place the lexical scanner + */ + public function resetPosition($position = 0) + { + $this->position = $position; + } + + /** + * Checks whether a given token matches the current lookahead. + * + * @param integer|string $token + * @return boolean + */ + public function isNextToken($token) + { + return null !== $this->lookahead && $this->lookahead['type'] === $token; + } + + /** + * Checks whether any of the given tokens matches the current lookahead + * + * @param array $tokens + * @return boolean + */ + public function isNextTokenAny(array $tokens) + { + return null !== $this->lookahead && in_array($this->lookahead['type'], $tokens, true); + } + + /** + * Moves to the next token in the input string. + * + * A token is an associative array containing three items: + * - 'value' : the string value of the token in the input string + * - 'type' : the type of the token (identifier, numeric, string, input + * parameter, none) + * - 'position' : the position of the token in the input string + * + * @return array|null the next token; null if there is no more tokens left + */ + public function moveNext() + { + $this->peek = 0; + $this->token = $this->lookahead; + $this->lookahead = (isset($this->tokens[$this->position])) + ? $this->tokens[$this->position++] : null; + + return $this->lookahead !== null; + } + + /** + * Tells the lexer to skip input tokens until it sees a token with the given value. + * + * @param string $type The token type to skip until. + */ + public function skipUntil($type) + { + while ($this->lookahead !== null && $this->lookahead['type'] !== $type) { + $this->moveNext(); + } + } + + /** + * Checks if given value is identical to the given token + * + * @param mixed $value + * @param integer $token + * @return boolean + */ + public function isA($value, $token) + { + return $this->getType($value) === $token; + } + + /** + * Moves the lookahead token forward. + * + * @return array | null The next token or NULL if there are no more tokens ahead. + */ + public function peek() + { + if (isset($this->tokens[$this->position + $this->peek])) { + return $this->tokens[$this->position + $this->peek++]; + } else { + return null; + } + } + + /** + * Peeks at the next token, returns it and immediately resets the peek. + * + * @return array|null The next token or NULL if there are no more tokens ahead. + */ + public function glimpse() + { + $peek = $this->peek(); + $this->peek = 0; + return $peek; + } + + /** + * Scans the input string for tokens. + * + * @param string $input a query string + */ + protected function scan($input) + { + static $regex; + + if ( ! isset($regex)) { + $regex = '/(' . implode(')|(', $this->getCatchablePatterns()) . ')|' + . implode('|', $this->getNonCatchablePatterns()) . '/i'; + } + + $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE; + $matches = preg_split($regex, $input, -1, $flags); + + foreach ($matches as $match) { + // Must remain before 'value' assignment since it can change content + $type = $this->getType($match[0]); + + $this->tokens[] = array( + 'value' => $match[0], + 'type' => $type, + 'position' => $match[1], + ); + } + } + + /** + * Gets the literal for a given token. + * + * @param integer $token + * @return string + */ + public function getLiteral($token) + { + $className = get_class($this); + $reflClass = new \ReflectionClass($className); + $constants = $reflClass->getConstants(); + + foreach ($constants as $name => $value) { + if ($value === $token) { + return $className . '::' . $name; + } + } + + return $token; + } + + /** + * Lexical catchable patterns. + * + * @return array + */ + abstract protected function getCatchablePatterns(); + + /** + * Lexical non-catchable patterns. + * + * @return array + */ + abstract protected function getNonCatchablePatterns(); + + /** + * Retrieve token type. Also processes the token value if necessary. + * + * @param string $value + * @return integer + */ + abstract protected function getType(&$value); +}